This appendix describes some best practices for resource adapter developers.
You can package resource adapter classes in one or more JAR files, and then place the JAR files in the RAR file. These are called nested JARs. When you nest JAR files in the RAR file, and classes need to be loaded by the classloader, the JARs within the RAR file must be opened and closed and iterated through for each class that must be loaded.
If there are very few JARs in the RAR file and if the JARs are relatively small in size, there will be no significant performance impact. On the other hand, if there are many JARs and the JARs are large in size, the performance impact can be great.
To avoid such performance issues, you can either:
Deploy the resource adapter in an exploded format. This eliminates the nesting of JARs and hence reduces the performance hit involved in looking for classes.
If deploying the resource adapter in exploded format is not an option, the JARs can be exploded within the RAR file. This also eliminates the nesting of JARs and thus improves the performance of classloading significantly.
Oracle recommends that resource adapters implement the optional enhancements described in sections 7.14.2 and 7.14.2 of the J2CA 1.5 Specification at
http://java.sun.com/j2ee/connector/download.html. Implementing these interfaces allows WebLogic Server to provide several features that will not be available without them.
Lazy Connection Association, as described in section 7.14.1, allows the server to automatically clean up unused connections and prevent applications from hogging resources. Lazy Transaction Enlistment, as described in 7.14.2, allows applications to start a transaction after a connection is already opened.
Resource adapter implementations should use the
WorkManager (as described in Chapter 10, "Work Management" in the J2CA 1.5 Specification at
http://java.sun.com/j2ee/connector/download.html) to launch operations that need to run in a new thread, rather than creating new threads directly. This allows WebLogic Server to manage and monitor these threads.
WebLogic Server supports the Common Client Interface (CCI) for EIS access, as defined in Chapter 15, "Common Client Interface" in the J 2CA 1.5 Specification at
http://java.sun.com/j2ee/connector/. The CCI defines a standard client API for application components that enables application components and EAI frameworks to drive interactions across heterogeneous EISes.
As a best practice, you should not store the
InteractionSpec class that the CCI resource adapter is required to implement in the RAR file. Instead, you should package it in a separate JAR file outside of the RAR file, so that the client can access it without having to put the
InteractionSpec interface class in the generic CLASSPATH.
With respect to the
InteractionSpec interface, it is important to remember that when all application components (EJBs, resource adapters, Web applications) are packaged in an EAR file, all common classes can be placed in the APP-INF/lib directory. This is the easiest possible scenario.
This is not the case for standalone resource adapters (packaged as RAR files). If the interface is serializable (as is the case with
InteractionSpec), then both the client and the resource adapter need access to the
InteractionSpec interface as well as the implementation classes. However, if the interface extends
java.io.Remote, then the client only needs access to the interface class.