[ Team LiB ] Previous Section Next Section

WebLogic RMI Best Practices

Use a Java client connecting to a Java implementation class when possible. Coding your RMI client applications in Java exploits both WebLogic's implementation of the JavaSoft RMI API (as discussed earlier) and the inherent strengths of Java to include, but not limited to, code portability, garbage collection, and security.

If you're developing a CORBA application, develop the Java remote interface and implementation class first, and then use IDL to create your client interfaces. You must determine whether your IDL client supports Objects-by-Value. If not, you can pass only other interfaces or CORBA primitive data types.

Design RMI systems to minimize remote method calls. Making few remote method calls that return larger data sets avoids the excessive overhead encountered when marshalling and unmarshalling objects. (Implementing the Externalizable interface versus the Serializable interface along with use of the transient keyword also reduces marshalling overhead.) Fewer method calls returning larger objects is more efficient than making many remote method calls returning many smaller objects. Designs should shun excessive object manipulation; that is, passing objects when only a few values are needed or returning objects when maintaining an object reference is unnecessary. Excessive method calls and coupled with excessive object manipulation can cause scalability and performance issues. If multiple remote method calls are unavoidable, try batching the remote method calls and combining method calls using a value object. Use of the Value Object design pattern allows for efficient transfer of finely grained data (many method calls) by providing a coarsely grained data view (batched method calls). Refer to Sun's documentation at http://java.sun.com/blueprints/patterns/j2ee_patterns/catalog.html for the details of the Value Object Design pattern.

Minimize distributed garbage collection by caching proxy stub classes. This strategy avoids unnecessary garbage collection. If used, you should implement a policy to delete unneeded or expired stubs from the cache.

In most cases, you should consider using session EJBs as opposed to pure RMI implementations. See Part V for detailed information on EJB implementation.

    [ Team LiB ] Previous Section Next Section