Earlier, we looked at the various types of EJBs supported by WebLogic, and the different circumstances under which you should use them. In this section, we examine some of the important design principles you should adopt when building an enterprise application using EJBs. Careful choices can help you extract the best performance out of your EJBs in a WebLogic environment.
EJB 2.0 standard introduces the notion of local EJBs, which provide
lightweight access from other EJBs and local clients running within
the same server. An EJB, whose home interface extends
EJBLocalHome and whose component interface extends
EJBLocalObject, is accessible only to local
clients running within the same JVM. Unlike remote EJBs where the
client communicates with the EJB over RMI-IIOP, a client can
communicate with a local EJB without incurring the overheads of
marshalling and unmarshalling associated with remote method calls.
Because both the client and the EJB reside within the same JVM, the
EJB container is able to use pass-by-reference
semantics, similar to an ordinary Java method call.
Consider using local EJBs when you want to ensure they are accessible only to other server-side components or local clients running within the same JVM. This means your local EJB interfaces will not be exposed to other remote clients — i.e., any client running on another JVM, or even another machine. EJBs that participate in container-managed relationships (CMR) with other ...