java.rmi.activation
Class ActivationGroup

java.lang.Object
  extended by java.rmi.server.RemoteObject
      extended by java.rmi.server.RemoteServer
          extended by java.rmi.server.UnicastRemoteObject
              extended by java.rmi.activation.ActivationGroup
All Implemented Interfaces:
Serializable, ActivationInstantiator, Remote

public abstract class ActivationGroup
extends UnicastRemoteObject
implements ActivationInstantiator

The entity that receives the request to activate object and activates it. Frequently there is one activation group per virtual machine.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Constructor Summary
protected ActivationGroup(ActivationGroupID aGroupId)
          Create the new activation group with the given group id.
 
Method Summary
protected  void activeObject(ActivationID id, MarshalledObject<? extends Remote> mObject)
          Makes the call back to the groups ActivationMonitor.
abstract  void activeObject(ActivationID id, Remote obj)
          The method is called when the object is exported.
static ActivationGroup createGroup(ActivationGroupID id, ActivationGroupDesc desc, long incarnation)
          Create the new instance of the activation group, using the class name and location information, stored in the passed descriptor.
static ActivationGroupID currentGroupID()
          Get the id of current activation group.
static ActivationSystem getSystem()
          Get the current activation system.
protected  void inactiveGroup()
          Makes the call back to the groups ActivationMonitor and sets the current group to null.
 boolean inactiveObject(ActivationID id)
          Notifies the monitor about the object being inactivated.
static void setSystem(ActivationSystem aSystem)
          Set the activation system for this virtual machine.
 
Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, unexportObject
 
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toString, toStub
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.rmi.activation.ActivationInstantiator
newInstance
 

Constructor Detail

ActivationGroup

protected ActivationGroup(ActivationGroupID aGroupId)
                   throws RemoteException
Create the new activation group with the given group id.

Parameters:
aGroupId - the group Id.
Throws:
RemoteException - if the group export fails.
Method Detail

activeObject

public abstract void activeObject(ActivationID id,
                                  Remote obj)
                           throws ActivationException,
                                  UnknownObjectException,
                                  RemoteException
The method is called when the object is exported. The group must notify the activation monitor, if this was not already done before.

Parameters:
id - the object activation id
obj - the remote object implementation
Throws:
ActivationException - if the group is inactive
UnknownObjectException - if such object is not known
RemoteException - if the call to monitor fails

inactiveObject

public boolean inactiveObject(ActivationID id)
                       throws ActivationException,
                              UnknownObjectException,
                              RemoteException
Notifies the monitor about the object being inactivated.

Parameters:
id - the object being inactivated.
Returns:
true always (must be overridden to return other values).
Throws:
ActivationException - never
UnknownObjectException - if the object is not known
RemoteException - if the remote call to monitor fails

createGroup

public static ActivationGroup createGroup(ActivationGroupID id,
                                          ActivationGroupDesc desc,
                                          long incarnation)
                                   throws ActivationException
Create the new instance of the activation group, using the class name and location information, stored in the passed descriptor. The method expects the group class to have the two parameter constructor, the first parameter being the ActivationGroupID and the second the MarshalledObject. The group must be first be registered with the ActivationSystem. Once a group is created, the currentGroupID method returns the identifier for this group until the group becomes inactive.

Parameters:
id - the activation group id
desc - the group descriptor, providing the information, necessary to create the group
incarnation - the incarnation number
Returns:
the created group instance
Throws:
ActivationException - if the activation fails due any reason

currentGroupID

public static ActivationGroupID currentGroupID()
Get the id of current activation group.

Returns:
the id of the current activation group or null if none exists.

setSystem

public static void setSystem(ActivationSystem aSystem)
                      throws ActivationException
Set the activation system for this virtual machine. The system can only be set if no group is active.

Parameters:
aSystem - the system to set
Throws:
ActivationException - if some group is active now.

getSystem

public static ActivationSystem getSystem()
                                  throws ActivationException
Get the current activation system. If the system is not set via setSystem(java.rmi.activation.ActivationSystem) method, the default system for this virtual machine is returned. The default system is first searched by name "java.rmi.activation.ActivationSystem" on the activation registry port. The default value of the activation registry port is ActivationSystem.SYSTEM_PORT, but it can be changed by putting the system property java.rmi.activation.port. Both activation system and activation registry are provided by the RMI daemon tool, RMID, if it is running on the local host. If the RMID is not running, the internal transient activation system will be created and returned. This internal system is highly limited in in capabilities and is not intended to be used anywhere apart automated testing.

Returns:
the activation system for this virtual machine
Throws:
ActivationException

activeObject

protected void activeObject(ActivationID id,
                            MarshalledObject<? extends Remote> mObject)
                     throws ActivationException,
                            UnknownObjectException,
                            RemoteException
Makes the call back to the groups ActivationMonitor.

Parameters:
id - the id obj the object being activated
mObject - the marshalled object, contains the activated remote object stub.
Throws:
ActivationException - on activation error
UnknownObjectException - if such object is not registered
RemoteException - on remote call (to monitor) error

inactiveGroup

protected void inactiveGroup()
                      throws UnknownGroupException,
                             RemoteException
Makes the call back to the groups ActivationMonitor and sets the current group to null.

Throws:
UnknownGroupException
RemoteException