W O R K S H O P

How Do You Take Your Java?

August 9, 1999
IBM WebSphere
IBM has bundled services for deployment and connection management around the Apache Web Server into its WebSphere Application Server (WAS). In addition to providing a Web server, the WAS runtime environment can operate as a plug-in to Microsoft's Internet Information Server (IIS) and Netscape Navigator/Communicator, acting as a broker for servlet traffic to and from the servlet manager.

Printer Print this Page
E-Mail E-mail this URL
WebSphere contains several features that simplify the development and management of servlets. Compared to the comfy environment of your favorite IDE, servlet debugging with Java-standard out-logging can seem like a throwback to the Dark Ages. WebSphere includes a WASRunner class to launch the application server in standalone mode, which lets you use your IDE for debugging. The Web server plug-in will detect WASRunner at startup and connect to it, so developers can use the same Web-server environment that's running in production.

Each servlet is associated with a servlet configuration, usually managed by the Application Server Manager. IBM has included an interesting class that maintains this information in an XML document, with the name, description, initialization parameters and a page list of your servlet. IBM provides PageListServlet and XMLServerConfig classes to make it easier to create and read the XML document. WebSphere has screens that simplify site administration and deployment tasks, letting you monitor servlet execution, connections, resource usage and response time.

GemStone/J
If you are using Java to deploy business rules in a large enterprise, you should be eyeing performance (scalability and availability) and cost (in terms of reducing code to write and maintain). GemStone/J is a multifaceted Java application server, hosting servlets, EJB, CORBA (Common Object Request Broker Architecture) and Distributed JavaBeans. It also provides transaction management, security, object storage, and communications and messaging services.

GemStone provides several services over and above the servlet engine. GemStone/J optionally supports Java object persistence, which effectively eliminates the need for an application developer to code methods for storing, retrieving and creating objects via object-to-relational or object serialization. GemStone implements this by extending the JVM to include a persistent cache architecture.

In addition to storing objects between invocation, the architecture provides a method to give state and application logic to a number of applications running on multiple Java virtual machines. Servlets and/or JavaBeans can be spread across a number of virtual machines or extended to other servers to achieve greater performance and high availability. "Scalability and Redundancy Options for Multiple Virtual Machines" (page 89) illustrates the GemStone shared virtual machine architecture.

Servlets and beans are often called upon to marshal resources from multiple, disparate sources (legacy systems, real-time feeds and content from other sites) and manage the creation and updates of elements within them. To simplify this task, GemStone/J encapsulates session work into transactions. The Object Transaction Monitor (OTM) supports the expected services of begin, commit, rollback and locking. GemStone administrators can configure the level of transaction control that the servlet requires from the cache without additional coding. Java developers can manage nonrelational transaction integrity by responding to events raised by the GemStone environment.

Oracle 8i
While Oracle has an application server product, we are interested in its use of the Java language within the classic database environment. As part of the server executable, Oracle 8i includes a JVM that executes within the address space and shares the memory heap with the RDBMS kernel. Oracle's JVM is a JDK 1.1.6-compliant environment. All database clients (such as query tools, report-writers and fat-client applications) can call Java-stored procedures just as they call any other stored procedure. You can thereby instantly enable a large population of clients. Java-stored procedures benefit from the overall environment; they are stored in compiled form and automatically cached and stored among users. Access to them is controlled by granting execution privileges on their invoker.

To deploy Java methods, a programmer develops the class using a favorite IDE. Two additional steps are then required. The database needs to be told which of the methods in the class is to be called from the SQL environment. The programmer then writes an Oracle PL/SQL call spec that identifies which Java methods are to be called from SQL. Next, the programmer maps the parameter and returns types to their SQL counterparts. Analogous to the utilities that load data into tables, the loadjava utility is used to upload the class into the schema. Then PL/SQL programmers can call them from any language construct, including as functions from select, update and insert statements. (See "Loading Java Into the RDBMS," at left, for an illustration of how Java components are loaded in the database.)

Within a Java class, standard JDBC calls are used to access a relational database. This is significant for two reasons; it's portable and it's fast. JDBC is the standard way to access relational data from Java. Normally, JDBC is used remotely between processes. Oracle has implemented JDBC as part of the JVM within the Oracle RDBMS. However, access is much faster than remote access because of the structure of the JDBC implementation. The JDBC within the RDBMS accesses the underlying internal libraries and memory directly, so it doesn't suffer from the overhead of network access, interprocess communications or process context switches, all of which take time.

All Java classes provided by Oracle are compiled to native code for faster execution. Additionally, a future version of the database will include an accelerator to translate user-written code to intermediate C code, which, in turn, is compiled to native code.

Send your comments on this article to Brian Walsh at bwalsh@nwc.com.



PAGE: 1 I 2 I FIRST PAGE
 

Research and Reports

Storage Virtualization Guide
May 2012

Network Computing: May 2012

TechWeb Careers