Some reader favorites:
EJB fundamentals and session beans
Create a scrollable virtual desktop in Swing
Web services test code generator
Klaus Berg has recently released a test-code generator for JUnit-based Web service clients. If you're developing Web services
using Axis2 and XMLBeans this wizard could turn your JUnit test client coding into a powerful code generation process. It
also has uses for those using GUI-based testing tools like soapUI.
| Memory Analysis in Eclipse |
| Enterprise AJAX - Transcend the Hype |
The Java RMI (Remote Method Invocation) API provides us with a clean way to build distributed Java applications. The components that make up these applications communicate with each other by invoking methods on their remote counterparts. Transparent RMI (TRMI) extends the RMI API to simplify distributed application development by eliminating most of the standard API's overhead.
This article details the benefits of using TRMI in place of standard RMI. It shows how distributed software developers can provide a cleaner design for their applications and focus on the problem at hand rather than on the details of remote invocation. The article also discusses how TRMI allows developers to easily retrofit an existing application with remote objects. I assume that you are familiar with the basics of RMI and Java's proxy mechanism.
Before describing RMI's drawbacks, let's review the steps required for creating a distributed application using RMI:
java.rmi.Remote. Furthermore, its methods must all declare that they throw java.rmi.RemoteException in case of an invocation problem.
java.rmi.server.UnicastRemoteObject, which implements all the setup required of an RMI server object.
java.rmi.Naming.
A developer wishing to create a nontrivial application using RMI faces several difficulties:
Remote, and their methods must throw RemoteException), interfaces not designed with RMI in mind cannot be used remotely.
try/catch block for catching the possible RemoteException. Therefore, you must scatter exception-handling code throughout the application. To avoid doing so, developers usually limit
remote invocation to a small portion of their programs.
RemoteExceptions also makes it difficult to use interfaces designed for remote execution locally.
Remote interfaces cannot easily extend arbitrary classes, since they normally extend UnicastRemoteObject. (You could avoid this limitation with some effort, by reimplementing UnicastRemoteObject.)
Transparent RMI overcomes these difficulties by using Java's reflection and proxy mechanisms. Before delving into TRMI's details,
let's see what a program that uses TRMI looks like. (Note that the code presented here is a slightly modified version of the
code you can download from Resources.) Suppose we want to call the Hello interface from a remote JVM: