CONTENTS | PREV | NEXT | Java Remote Method Invocation |
The ActivationInstantiator is responsible for creating instances of activatable objects. A concrete subclass of ActivationGroup implements thenewInstance
method to handle creating objects within the group.package java.rmi.activation;The activator calls an instantiator's
public interface ActivationInstantiator
extends java.rmi.Remote
{
public MarshalledObject newInstance(ActivationID id,
ActivationDesc desc)
throws ActivationException, java.rmi.RemoteException;
}newInstance
method in order to recreate in that group an object with the activation identifier, id, and descriptor, desc. The instantiator is responsible for:
- determining the class for the object using the descriptor's
getClassName
method,- loading the class from the CodeSource obtained from the descriptor (using the
getCodeSource
method),- creating an instance of the class by invoking the special "activation" constructor of the object's class that takes two arguments: the object's ActivationID, and the MarshalledObject containing object specific initialization data, and
- returning a MarshalledObject containing the remote object it created.
An instantiator is also responsible for reporting when objects it creates/activates are no longer active, so that it can make the appropriateinactiveObject
call to its ActivationMonitor (see the ActivationGroup class for more details).If object activation fails, then the newInstance method throws ActivationException. If the remote call fails, then the method throws RemoteException.