|CONTENTS | PREV | NEXT||Java Remote Method Invocation|
During a remote method invocation, if the "live" reference for a target object is unknown, the faulting reference engages in the activation protocol. The activation protocol involves several entities: the faulting reference, the activator, an activation group in a Java VM, and the remote object being activated.
The activator (usually one per host) is the entity which supervises activation by being both:
- a database of information that maps activation identifiers to the information necessary to activate an object (the object's class, the location--a URL path-- from where the class can be loaded, specific data the object may need to bootstrap, etc.), and
- a manager of Java Virtual Machines, that starts up VMs (when necessary) and forwards requests for object activation (along with the necessary information) to the correct activation group inside a remote VM.
Note that the activator keeps the current mapping of activation identifiers to active objects as a cache, so that the group does not need to be consulted on each activation request.
An activation group (one per Java VM) is the entity which receives a request to activate an object in the Java VM and returns the activated object back to the activator.
The activation protocols is as follows. A faulting reference uses an activation identifier and calls the activator (an internal RMI interface) to activate the object associated with the identifier. The activator looks up the object's activation descriptor (registered previously). The object's descriptor contains:
- the object's group identifier (specifies the VM in which it is activated),
- the object's class name,
- a URL path from where to load the object's class code,
- object-specific initialization data in marshalled form (initialization data might be the name of a file containing the object's persistent state, for example).
If the activation group in which this object should reside exists, the activator forwards the activation request to that group. If the activation group does not exist, the activator initiates a VM executing an activation group and then forwards the activation request to that group.
The activation group loads the class for the object and instantiates the object using a special constructor that takes several arguments, including the activation descriptor registered previously.
When the object is finished activating, the activation group passes back a marshalled object reference to the activator that then records the activation identifier and active reference pairing and returns the active (live) reference to the faulting reference. The faulting reference (inside the stub) then forwards method invocations via the live reference directly to the remote object.
Note - In the JDK, RMI provides an implementation of the activation system interfaces. In order to use activation, you must first run the activation system daemon rmid.