So far, we’ve sketched the basic motivation for factories, and talked a little bit about things such as distributed lock management and the basic functionality that a well-implemented factory can add to an application. We’ve waved our hands, however, at one of the harder parts: actually launching servers.
There’s a good reason for this. As of Java 2, RMI includes a very generic and reusable factory implementation, called the Activation Framework, which handles the details of launching servers on remote machines quite nicely, and does so in a way that’s completely transparent to clients.
The key to the
activation framework is the activation
daemon, a.k.a. the
rmid program. The RMI
activation daemon is an RMI server, just like the
RMI registry, whose sole purpose is to launch Java
servers. The topology of a distributed application
is shown in Figure 17-2.
Figure 17-2. Topology for an application using activatable servers
that when I say that the activation daemon is an
RMI server, I mean precisely that. It is an RMI
server that implements the
ActivationSystem interface, has stubs and skeletons, passes serialized objects, and behaves according to the same rules and principles as any other RMI server. In fact, it’s not a particularly complex server either; you know more than enough to implement it yourself at this point. The JVMs that are launched by the activation ...