100% found this document useful (2 votes)
2K views

Activation Model in RMI

The document discusses object activation in RMI. It describes how passive remote objects can be activated and made active when first accessed. The activation protocol involves a faulting reference, activator, and activation group. The activator manages object activation by mapping activation IDs to virtual machines. When a passive object is first accessed, its activation ID is used to activate the object by starting its VM and instantiating the object. Key classes involved are ActivationDesc, ActivationID, and Activatable.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
100% found this document useful (2 votes)
2K views

Activation Model in RMI

The document discusses object activation in RMI. It describes how passive remote objects can be activated and made active when first accessed. The activation protocol involves a faulting reference, activator, and activation group. The activator manages object activation by mapping activation IDs to virtual machines. When a passive object is first accessed, its activation ID is used to activate the object by starting its VM and instantiating the object. Key classes involved are ActivationDesc, ActivationID, and Activatable.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 13

Activation Model in RMI

• Object activation is a mechanism for providing persistent


references to objects and managing the execution of object
implementations.

• When an activatable remote object is accessed (via a method


invocation) if that remote object is not currently executing, the
system initiates the object's execution inside an appropriate JVM

• active object is a remote object that is instantiated and exported


in a JVM on some system.
• A passive object is one that is not yet instantiated (or exported)
in a JVM, but which can be brought into an active state.
• Transforming a passive object into an active object is a process
known as activation.
Lazy Activation
• Lazy activation of remote objects is implemented using a faulting remote
reference ( fault block).
• A faulting remote reference to a remote object "faults in" the active
object's reference upon the first method invocation to the object.
• maintains both
a persistent handle (an activation identifier)
contains enough information to activate the object
transient remote reference
"live" reference - to contact the executing object

null – target object- not known to be active

method invocation-FRR engages activation protocol to obtain live


reference
Activation Protocol
• The AP involves several entities:
• the faulting reference,
• the activator,
• an activation group,
• remote object being activated.
•The activator (usually one per host) is the entity which
supervises activation by being both:
1.a database of information that maps activation
identifiers
2.a manager of Java virtual machines, that starts up
JVMs and forwards requests for object activation to
the correct activation group inside a remote JVM.
•An activation group (one per JVM) is the entity which receives a
request to activate an object in the JVM and returns the activated
object back to the activator.
The ActivationDesc Class

• An ActivationDesc contains the information necessary to


activate an object.

– the object's activation group identifier,

– the class name for the object,

– a codebase path (or URLs) from which the object's code can be
loaded,

– and a MarshalledObject that may contain object-specific


initialization data used during each activation.
• package java.rmi.activation;
•  
• public final class ActivationDesc implements java.io.Serializable
• {

• public ActivationDesc(String className,
• String codebase,
• java.rmi.MarshalledObject data)
• throws ActivationException;
•  
• public ActivationDesc(String className,
• String codebase,
• java.rmi.MarshalledObject data,
• boolean restart)
• throws ActivationException;
•  
• public ActivationDesc(ActivationGroupID groupID,
• String className,
• String codebase,
• java.rmi.MarshalledObject data,
• boolean restart);
•  
• public ActivationDesc(ActivationGroupID groupID,
• String className,
• String codebase,
• java.rmi.MarshalledObject data);
•   public ActivationGroupID getGroupID();
•   public String getClassName();
•   public String getLocation();
•   public java.rmi.MarshalledObject getData()
•   public boolean getRestartMode();
• }
The ActivationID Class
• The activation protocol makes use of activation identifiers to
denote remote objects that can be activated over time. An
activation identifier contains :
• a remote reference to the object's activator, and
• a unique identifier for the object.
• An activation identifier for an object can be obtained by
registering an object with the activation system. Registration is
accomplished in a few ways (also noted above):
• via the Activatable.register method, or
• via the first or second Activatable constructor, which both registers
and exports the object, or
• via the first or second Activatable.exportObject method, this
method both registers and exports the object.
• package java.rmi.activation;
•  
• public class ActivationID implements java.io.Serializable
• {
• public ActivationID(Activator activator);
•  
• public Remote activate(boolean force)
• throws ActivationException, UnknownObjectException,
• java.rmi.RemoteException;

•  
• public boolean equals(Object obj);
•  
• public int hashCode();
• }
The Activatable Class
• The Activatable class provides support for remote objects that require
persistent access over time and that can be activated by the system. The class
Activatable is the main API that developers need to use to implement and
manage activatable objects. Note that you must first run the activation system
daemon, rmid, before objects can be registered and/or activated.
• package java.rmi.activation;
•  
• public abstract class Activatable
• extends java.rmi.server.RemoteServer
• {
• protected Activatable(String codebase,
• java.rmi.MarshalledObject data,
• boolean restart,
• int port)
• throws ActivationException, java.rmi.RemoteException;
•  

• protected Activatable(String codebase,
• java.rmi.MarshalledObject data,
• boolean restart, int port,
• RMIClientSocketFactory csf,
• RMIServerSocketFactory ssf)
• throws ActivationException, java.rmi.RemoteException;
•  
• protected Activatable(ActivationID id, int port)
• throws java.rmi.RemoteException;
•  
• protected Activatable(ActivationID id, int port,
• RMIClientSocketFactory csf,
• RMIServerSocketFactory ssf)
• throws java.rmi.RemoteException;
•  
• protected ActivationID getID();
•  
• public static Remote register(ActivationDesc desc)
• throws UnknownGroupException, ActivationException,
• java.rmi.RemoteException;
•  

• public static boolean inactive(ActivationID id)
• throws UnknownObjectException, ActivationException,
• java.rmi.RemoteException;
•  
• public static void unregister(ActivationID id)
• throws UnknownObjectException, ActivationException,
• java.rmi.RemoteException;
•  
• public static ActivationID exportObject(Remote obj,
• String codebase,
• MarshalledObject data,
• boolean restart,
• int port)
• throws ActivationException, java.rmi.RemoteException;
•  

• public static ActivationID exportObject(Remote obj,
• String codebase,
• MarshalledObject data,
• boolean restart,
• int port,
• RMIClientSocketFactory csf,
• RMIServerSocketFactory ssf)
• throws ActivationException, java.rmi.RemoteException;
•  public static Remote exportObject(Remote obj,
• ActivationID id,
• int port)
• throws java.rmi.RemoteException;
•  public static Remote exportObject(Remote obj,
• ActivationID id,
• int port,
• RMIClientSocketFactory csf,
• RMIServerSocketFactory ssf)
• throws java.rmi.RemoteException;
•   public static boolean unexportObject(Remote obj, boolean force)
• throws java.rmi.NoSuchObjectException;
• }

You might also like