Client comparison

After presenting the different ways of accessing enterprise beans from a client application (a servlet in our examples), let’s now see the advantages and disadvantages of using them.

Direct access

This is the straightforward way for a client to access an enterprise bean. The home of the bean should be cached in a static variable and be initialized in the init method of the servlet. This gives good performance. However, the result of each method invocation performed by the client is a remote call. Even if the client is a servlet running in the same application server as the EJB container (same JVM), all the method calls are routed through the TCP/IP stack. Of course, this has an impact on the performance of the application. ...

Get EJB 2.0 Development with WebSphere Studio Application Developer now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.