- java.lang.Object
-
- java.rmi.server.RemoteObject
-
- java.rmi.server.RemoteServer
-
- java.rmi.server.UnicastRemoteObject
-
- java.rmi.activation.ActivationGroup
-
- All Implemented Interfaces:
- Serializable, ActivationInstantiator, Remote
public abstract class ActivationGroup extends UnicastRemoteObject implements ActivationInstantiator
AnActivationGroup
is responsible for creating new instances of "activatable" objects in its group, informing itsActivationMonitor
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:- as a side-effect of creating an
ActivationDesc
without an explicitActivationGroupID
for the first activatable object in the group, or - via the
ActivationGroup.createGroup
method - as a side-effect of activating the first object in a group
whose
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 theActivationGroup.createGroup
static method. ThecreateGroup
method has two requirements on the group to be created: 1) the group must be a concrete subclass ofActivationGroup
, and 2) the group must have a constructor that takes two arguments:- the group's
ActivationGroupID
, and - the group's initialization data (in a
java.rmi.MarshalledObject
)
When created, the default implementation of
ActivationGroup
will override the system properties with the properties requested when itsActivationGroupDesc
was created, and will set ajava.rmi.RMISecurityManager
as the default system security manager. If your application requires specific properties to be set when objects are activated in the group, the application should create a specialProperties
object containing these properties, then create anActivationGroupDesc
with theProperties
object, and useActivationGroup.createGroup
before creating anyActivationDesc
s (before the defaultActivationGroupDesc
is created). If your application requires the use of a security manager other thanjava.rmi.RMISecurityManager
, in the ActivativationGroupDescriptor properties list you can setjava.security.manager
property to the name of the security manager you would like to install.- Since:
- 1.2
- See Also:
ActivationInstantiator
,ActivationGroupDesc
,ActivationGroupID
, Serialized Form
-
-
Field Summary
-
Fields inherited from class java.rmi.server.RemoteObject
ref
-
-
Constructor Summary
Constructors Modifier Constructor and Description protected
ActivationGroup(ActivationGroupID groupID)
Constructs an activation group with the given activation group identifier.
-
Method Summary
Methods Modifier and Type Method and Description protected void
activeObject(ActivationID id, MarshalledObject<? extends Remote> mobj)
This protected method is necessary for subclasses to make theactiveObject
callback to the group's monitor.abstract void
activeObject(ActivationID id, Remote obj)
The group'sactiveObject
method is called when an object is exported (either byActivatable
object construction or an explicit call toActivatable.exportObject
.static ActivationGroup
createGroup(ActivationGroupID id, ActivationGroupDesc desc, long incarnation)
Create and set the activation group for the current VM.static ActivationGroupID
currentGroupID()
Returns the current activation group's identifier.static ActivationSystem
getSystem()
Returns the activation system for the VM.protected void
inactiveGroup()
This protected method is necessary for subclasses to make theinactiveGroup
callback to the group's monitor.boolean
inactiveObject(ActivationID id)
The group'sinactiveObject
method is called indirectly via a call to theActivatable.inactive
method.static void
setSystem(ActivationSystem system)
Set the activation system for the VM.-
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 groupID) throws RemoteException
Constructs an activation group with the given activation group identifier. The group is exported as ajava.rmi.server.UnicastRemoteObject
.- Parameters:
groupID
- the group's identifier- Throws:
RemoteException
- if this group could not be exported- Since:
- 1.2
-
-
Method Detail
-
inactiveObject
public boolean inactiveObject(ActivationID id) throws ActivationException, UnknownObjectException, RemoteException
The group'sinactiveObject
method is called indirectly via a call to theActivatable.inactive
method. A remote object implementation must callActivatable
'sinactive
method when that object deactivates (the object deems that it is no longer active). If the object does not callActivatable.inactive
when it deactivates, the object will never be garbage collected since the group keeps strong references to the objects it creates.The group's
inactiveObject
method unexports the remote object from the RMI runtime so that the object can no longer receive incoming RMI calls. An object will only be unexported if the object has no pending or executing calls. The subclass ofActivationGroup
must override this method and unexport the object.After removing the object from the RMI runtime, the group must inform its
ActivationMonitor
(via the monitor'sinactiveObject
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.This method simply informs the group's monitor that the object is inactive. It is up to the concrete subclass of ActivationGroup to fulfill the additional requirement of unexporting the object.
- Parameters:
id
- the object's activation identifier- Returns:
- true if the object was successfully deactivated; otherwise returns false.
- Throws:
UnknownObjectException
- if object is unknown (may already be inactive)RemoteException
- if call informing monitor failsActivationException
- if group is inactive- Since:
- 1.2
-
activeObject
public abstract void activeObject(ActivationID id, Remote obj) throws ActivationException, UnknownObjectException, RemoteException
The group'sactiveObject
method is called when an object is exported (either byActivatable
object construction or an explicit call toActivatable.exportObject
. The group must inform itsActivationMonitor
that the object is active (via the monitor'sactiveObject
method) if the group hasn't already done so.- Parameters:
id
- the object's identifierobj
- the remote object implementation- Throws:
UnknownObjectException
- if object is not registeredRemoteException
- if call informing monitor failsActivationException
- if group is inactive- Since:
- 1.2
-
createGroup
public static ActivationGroup createGroup(ActivationGroupID id, ActivationGroupDesc desc, long incarnation) throws ActivationException
Create and set the activation group for the current VM. The activation group can only be set if it is not currently set. An activation group is set using thecreateGroup
method when theActivator
initiates the re-creation of an activation group in order to carry out incomingactivate
requests. A group must first be registered with theActivationSystem
before it can be created via this method.The group class specified by the
ActivationGroupDesc
must be a concrete subclass ofActivationGroup
and have a public constructor that takes two arguments: theActivationGroupID
for the group and theMarshalledObject
containing the group's initialization data (obtained from theActivationGroupDesc
.If the group class name specified in the
ActivationGroupDesc
isnull
, then this method will behave as if the group descriptor contained the name of the default activation group implementation class.Note that if your application creates its own custom activation group, a security manager must be set for that group. Otherwise objects cannot be activated in the group.
java.rmi.RMISecurityManager
is set by default.If a security manager is already set in the group VM, this method first calls the security manager's
checkSetFactory
method. This could result in aSecurityException
. If your application needs to set a different security manager, you must ensure that the policy file specified by the group'sActivationGroupDesc
grants the group the necessary permissions to set a new security manager. (Note: This will be necessary if your group downloads and sets a security manager).After the group is created, the
ActivationSystem
is informed that the group is active by calling theactiveGroup
method which returns theActivationMonitor
for the group. The application need not callactiveGroup
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.- Parameters:
id
- the activation group's identifierdesc
- the activation group's descriptorincarnation
- the group's incarnation number (zero on group's initial creation)- Returns:
- the activation group for the VM
- Throws:
ActivationException
- if group already exists or if error occurs during group creationSecurityException
- if permission to create group is denied. (Note: The default implementation of the security managercheckSetFactory
method requires the RuntimePermission "setFactory")- Since:
- 1.2
- See Also:
SecurityManager.checkSetFactory()
-
currentGroupID
public static ActivationGroupID currentGroupID()
Returns the current activation group's identifier. Returns null if no group is currently active for this VM.- Returns:
- the activation group's identifier
- Since:
- 1.2
-
setSystem
public static void setSystem(ActivationSystem system) throws ActivationException
Set the activation system for the VM. The activation system can only be set it if no group is currently active. If the activation system is not set via this call, then thegetSystem
method attempts to obtain a reference to theActivationSystem
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 byActivationSystem.SYSTEM_PORT
. This port can be overridden by setting the propertyjava.rmi.activation.port
.If there is a security manager, this method first calls the security manager's
checkSetFactory
method. This could result in a SecurityException.- Parameters:
system
- remote reference to theActivationSystem
- Throws:
ActivationException
- if activation system is already setSecurityException
- if permission to set the activation system is denied. (Note: The default implementation of the security managercheckSetFactory
method requires the RuntimePermission "setFactory")- Since:
- 1.2
- See Also:
getSystem()
,SecurityManager.checkSetFactory()
-
getSystem
public static ActivationSystem getSystem() throws ActivationException
Returns the activation system for the VM. The activation system may be set by thesetSystem
method. If the activation system is not set via thesetSystem
method, then thegetSystem
method attempts to obtain a reference to theActivationSystem
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 byActivationSystem.SYSTEM_PORT
. This port can be overridden by setting the propertyjava.rmi.activation.port
.- Returns:
- the activation system for the VM/group
- Throws:
ActivationException
- if activation system cannot be obtained or is not bound (means that it is not running)- Since:
- 1.2
- See Also:
setSystem(java.rmi.activation.ActivationSystem)
-
activeObject
protected void activeObject(ActivationID id, MarshalledObject<? extends Remote> mobj) throws ActivationException, UnknownObjectException, RemoteException
This protected method is necessary for subclasses to make theactiveObject
callback to the group's monitor. The call is simply forwarded to the group'sActivationMonitor
.- Parameters:
id
- the object's identifiermobj
- a marshalled object containing the remote object's stub- Throws:
UnknownObjectException
- if object is not registeredRemoteException
- if call informing monitor failsActivationException
- if an activation error occurs- Since:
- 1.2
-
inactiveGroup
protected void inactiveGroup() throws UnknownGroupException, RemoteException
This protected method is necessary for subclasses to make theinactiveGroup
callback to the group's monitor. The call is simply forwarded to the group'sActivationMonitor
. Also, the current group for the VM is set to null.- Throws:
UnknownGroupException
- if group is not registeredRemoteException
- if call informing monitor fails- Since:
- 1.2
-
-
Nederlandse vertaling
U hebt gevraagd om deze site in het Nederlands te bezoeken. Voor nu wordt alleen de interface vertaald, maar nog niet alle inhoud.Als je me wilt helpen met vertalingen, is je bijdrage welkom. Het enige dat u hoeft te doen, is u op de site registreren en mij een bericht sturen waarin u wordt gevraagd om u toe te voegen aan de groep vertalers, zodat u de gewenste pagina's kunt vertalen. Een link onderaan elke vertaalde pagina geeft aan dat u de vertaler bent en heeft een link naar uw profiel.
Bij voorbaat dank.
Document heeft de 11/06/2005 gemaakt, de laatste keer de 04/03/2020 gewijzigd
Bron van het afgedrukte document:https://www.gaudry.be/nl/java-api-rf-java/rmi/activation/ActivationGroup.html
De infobrol is een persoonlijke site waarvan de inhoud uitsluitend mijn verantwoordelijkheid is. De tekst is beschikbaar onder CreativeCommons-licentie (BY-NC-SA). Meer info op de gebruiksvoorwaarden en de auteur.
Referenties
Deze verwijzingen en links verwijzen naar documenten die geraadpleegd zijn tijdens het schrijven van deze pagina, of die aanvullende informatie kunnen geven, maar de auteurs van deze bronnen kunnen niet verantwoordelijk worden gehouden voor de inhoud van deze pagina.
De auteur Deze site is als enige verantwoordelijk voor de manier waarop de verschillende concepten, en de vrijheden die met de referentiewerken worden genomen, hier worden gepresenteerd. Vergeet niet dat u meerdere broninformatie moet doorgeven om het risico op fouten te verkleinen.