java.rmi.activation
Class ActivationID

java.lang.Object
  extended byjava.rmi.activation.ActivationID
All Implemented Interfaces:
Serializable

public class ActivationID
extends Object
implements Serializable

Activation makes use of special identifiers to denote remote objects that can be activated over time. An activation identifier (an instance of the class ActivationID) contains several pieces of information needed for activating an 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:

Since:
1.2
Author:
Ann Wollrath
See Also:
Activatable, Serialized Form

Field Summary
private  Activator activator
          the object's activator
private static String activatorClassName
           
private static long serialVersionUID
          indicate compatibility with the Java 2 SDK v1.2 version of class
private  UID uid
          the object's unique id
 
Constructor Summary
ActivationID(Activator activator)
          The constructor for ActivationID takes a single argument, activator, that specifies a remote reference to the activator responsible for activating the object associated with this identifier.
 
Method Summary
 Remote activate(boolean force)
          Activate the object for this id.
 boolean equals(Object obj)
          Compares two activation ids for content equality.
 int hashCode()
          Returns a hashcode for the activation id.
private  void readObject(ObjectInputStream in)
          readObject for custom serialization.
private  void writeObject(ObjectOutputStream out)
          writeObject for custom serialization.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

activator

private transient Activator activator
the object's activator


uid

private transient UID uid
the object's unique id


serialVersionUID

private static final long serialVersionUID
indicate compatibility with the Java 2 SDK v1.2 version of class

See Also:
Constant Field Values

activatorClassName

private static String activatorClassName
Constructor Detail

ActivationID

public ActivationID(Activator activator)
The constructor for ActivationID takes a single argument, activator, that specifies a remote reference to the activator responsible for activating the object associated with this identifier. An instance of ActivationID is globally unique.

Parameters:
activator - reference to the activator responsible for activating the object
Since:
1.2
Method Detail

activate

public Remote activate(boolean force)
                throws ActivationException,
                       UnknownObjectException,
                       RemoteException
Activate the object for this id.

Parameters:
force - if true, forces the activator to contact the group when activating the object (instead of returning a cached reference); if false, returning a cached value is acceptable.
Returns:
the reference to the active remote object
Throws:
ActivationException - if activation fails
UnknownObjectException - if the object is unknown
RemoteException - if remote call fails
Since:
1.2

hashCode

public int hashCode()
Returns a hashcode for the activation id. Two identifiers that refer to the same remote object will have the same hash code.

Overrides:
hashCode in class Object
Returns:
a hash code value for this object.
Since:
1.2
See Also:
Hashtable

equals

public boolean equals(Object obj)
Compares two activation ids for content equality. Returns true if both of the following conditions are true: 1) the unique identifiers equivalent (by content), and 2) the activator specified in each identifier refers to the same remote object.

Overrides:
equals in class Object
Parameters:
obj - the Object to compare with
Returns:
true if these Objects are equal; false otherwise.
Since:
1.2
See Also:
Hashtable

writeObject

private void writeObject(ObjectOutputStream out)
                  throws IOException,
                         ClassNotFoundException
writeObject for custom serialization.

This method writes this object's serialized form for this class as follows:

The writeObject method is invoked on out passing this object's unique identifier (a UID instance) as the argument.

Next, the getRefClass method is invoked on the activator's RemoteRef instance to obtain its external ref type name. Next, the writeUTF method is invoked on out with the value returned by getRefClass, and then the writeExternal method is invoked on the RemoteRef instance passing out as the argument.

Throws:
IOException
ClassNotFoundException

readObject

private void readObject(ObjectInputStream in)
                 throws IOException,
                        ClassNotFoundException
readObject for custom serialization.

This method reads this object's serialized form for this class as follows:

The readObject method is invoked on in to read this object's unique identifier (a UID instance).

Next, the readUTF method is invoked on in to read the external ref type name of the RemoteRef instance for this object's activator. Next, the RemoteRef instance is created of an implementation-specific class corresponding to the external ref type name (returned by readUTF), and the readExternal method is invoked on that RemoteRef instance to read the external form corresponding to the external ref type name.

Note: If the external ref type name is "UnicastRef", "UnicastServerRef", "UnicastRef2", "UnicastServerRef2", "ActivatableRef", or "ActivatableServerRef", a corresponding implementation-specific class must be found, and its readExternal method must read the serial data for that external ref type name as specified to be written in the serialData documentation for this class. If the external ref type name is any other string (of non-zero length), a ClassNotFoundException will be thrown, unless the implementation provides an implementation-specific class corresponding to that external ref type name, in which case the RemoteRef will be an instance of that implementation-specific class.

Throws:
IOException
ClassNotFoundException