Using RMI with Apache Jserv - Conclusion (
Page 4 of 4 )
As you can see, RMI allowed us to host the Directory service on a
machine separate from the web server. Not only does this allow us to load
balance applications, but it also allows your Apache Jserv box to connect to
data sources hosted on different machines with different OS's. For example, in a
two tier approach, a WinNT or Solaris server could host the the database or
application server, and your Linux Apache-Jserv machine would then access the
data sources via RMI.
The code on the client side is fairly straightforward. The servlet only knows
about the Directory interface, and all the code dealing with the data
storage & retrieval is hidden behind that interface. The RMI service
implementation, server.AddressBook is a simple example, using a
HashMap to store the data. A more robust Directory
implementation data would store its data in a database or LDAP server. For the
servlet (RMI client), it doesn't matter where the data is coming from; it's
happy as long as the service implementing the directory.Directory
interface is available from the RMI registry.
Resources