All Packages Class Hierarchy This Package Previous Next Index
java.lang.Object | +----java.rmi.server.RemoteObject | +----java.rmi.server.RemoteServer | +----java.rmi.server.UnicastRemoteObject | +----java.rmi.activation.ActivationGroup
ActivationGroup
is responsible for creating new
instances of "activatable" objects in its group, informing its
ActivationMonitor
when either: its object's become
active or inactive, or the group as a whole becomes inactive.
An ActivationGroup
is initially created in one
of several ways:
ActivationDesc
for an object, or
ActivationGroup.createGroup
method
ActivationGroupDesc
was only registered.
Only the activator can recreate an
ActivationGroup
. The activator spawns, as needed, a
separate VM (as a child process, for example) for each registered
activation group and directs activation requests to the appropriate
group. It is implementation specific how VMs are spawned. An
activation group is created via the
ActivationGroup.createGroup
static method. The
createGroup
method has two requirements on the group
to be created: 1) the group must be a concrete subclass of
ActivationGroup
, and 2) the group must have a
constructor that takes two arguments:
ActivationGroupID
, and
java.rmi.MarshalledObject
)
When created, the default implementation of
ActivationGroup
will set the system properties to the
system properties in force when its
ActivationGroupDesc
was created, and will set the
security manager to the java.rmi.RMISecurityManager
.
If your application requires some specific properties to be set
when objects are activated in the group, the application should set
the properties before creating any ActivationDesc
s
(before the default ActivationGroupDesc
is created).
If your application requires the use of a security manager other
than the RMISecurityManager
, set the following two
properties to specify the SecurityManager
class and
codebase:
java.rmi.activation.security.class
java.rmi.activation.security.codebase
activeObject
callback to the group's
monitor.
activeObject
method is called when an
object is exported (either by Activatable
object
construction or an explicit call to
Activatable.exportObject.
createGroup(ActivationGroupID, ActivationGroupDesc, long)
- Create and set the activation group for the current VM.
currentGroupID()
- Returns the current activation group's identifier.
getSystem()
- Returns the activation system for the VM.
inactiveGroup()
- This protected method is necessary for subclasses to
make the
inactiveGroup
callback to the group's
monitor.
inactiveObject(ActivationID)
- The group's
inactiveObject
method is called
indirectly via a call to the Activatable.inactive
method.
newInstance(ActivationID, ActivationDesc)
- Creates a new instance of an activatable remote object.
setSystem(ActivationSystem)
- Set the activation system for the VM.
protected ActivationGroup(ActivationGroupID groupID) throws RemoteException
public abstract MarshalledObject newInstance(ActivationID id, ActivationDesc desc) throws ActivationException
Activator
calls this method to create an activatable
object in this group.
public void inactiveObject(ActivationID id) throws ActivationException, UnknownObjectException, RemoteException
inactiveObject
method is called
indirectly via a call to the Activatable.inactive
method. A remote object implementation must call
Activatable
's inactive
method when
that object deactivates (the object deems that it is no longer
active). If the object does not call
Activatable.inactive
when it deactivates, the
object will never be garbage collector since the group keeps
strong references to the objects it creates.
The group's inactiveObject
method forcibly
unexports the remote object from the RMI runtime so that the
object can no longer receive incoming RMI calls. After removing
the object from the RMI runtime, the group informs its
ActivationMonitor
(via the monitor's
inactiveObject
method) that the remote object is
not currently active so that the remote object will be
re-activated by the activator upon a subsequent activation
request.
public abstract void activeObject(ActivationID id, Remote obj) throws ActivationException, UnknownObjectException, RemoteException
activeObject
method is called when an
object is exported (either by Activatable
object
construction or an explicit call to
Activatable.exportObject. The group must inform its
ActivationMonitor
that the object is active (via
the monitor's activeObject
method) if the group
hasn't already done so.
- Parameters:
- id - the object's identifier
- obj - the remote object implementation
- Throws:
UnknownObjectException
- if object is not registered
- Throws:
RemoteException
- if call informing monitor fails
public static ActivationGroup createGroup(ActivationGroupID id, ActivationGroupDesc desc, long incarnation) throws ActivationException
createGroup
method when the Activator
initiates the
re-creation of an activation group in order to carry out
incoming activate
requests. A group must first
be registered with the ActivationSystem
before
it can be created via this method.
The group specified by the ActivationGroupDesc
must be a concrete subclass of ActivationGroup
and have a public constructor that takes two arguments: the
ActivationGroupID
for the group and the
MarshalledObject
containing the group's
initialization data (obtained from the
ActivationGroupDesc
. Note: if your application
creates its own custom activation group, the group must
set a security manager in the constructor, or objects
cannot be activated in the group.
After the group is created, the ActivationSystem
is informed that the group is active by calling the
activeGroup
method which returns the
ActivationMonitor
for the group. The application
need not call activeGroup
independently since
it is taken care of by this method.
Once a group is created, subsequent calls to the
currentGroupID
method will return the identifier for
this group until the group becomes inactive.
public static ActivationGroupID currentGroupID()
public static void setSystem(ActivationSystem system) throws ActivationException
getSystem
method attempts to obtain a reference to the
ActivationSystem
by looking up the name
"java.rmi.activation.ActivationSystem" in the Activator's
registry. By default, the port number used to look up the
activation system is defined by
ActivationSystem.SYSTEM_PORT
. This port can be overridden
by setting the property java.rmi.activation.port
.
ActivationSystem
public static ActivationSystem getSystem() throws ActivationException
setSystem
method. If the
activation system is not set via the setSystem
method, then the getSystem
method attempts to
obtain a reference to the ActivationSystem
by
looking up the name "java.rmi.activation.ActivationSystem" in
the Activator's registry. By default, the port number used to
look up the activation system is defined by
ActivationSystem.SYSTEM_PORT
. This port can be
overridden by setting the property
java.rmi.activation.port
.
protected void activeObject(ActivationID id, MarshalledObject mobj) throws ActivationException, UnknownObjectException, RemoteException
activeObject
callback to the group's
monitor. The call is simply forwarded to the group's
ActivationMonitor
.
protected void inactiveGroup() throws UnknownGroupException, RemoteException
inactiveGroup
callback to the group's
monitor. The call is simply forwarded to the group's
ActivationMonitor
. Also, the current group
for the VM is set to null.
All Packages Class Hierarchy This Package Previous Next Index