java.rmi.server
Class ObjID

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by java.rmi.server.ObjID
All Implemented Interfaces:
Serializable sample code for java.io.Serializable definition code for java.io.Serializable

public final class ObjID
extends Object sample code for java.lang.Object definition code for java.lang.Object
implements Serializable sample code for java.io.Serializable definition code for java.io.Serializable

An ObjID is used to identify a remote object exported to an RMI runtime. When a remote object is exported, it is assigned an object identifier either implicitly or explicitly, depending on the API used to export.

The ObjID() sample code for java.rmi.server.ObjID.ObjID() definition code for java.rmi.server.ObjID.ObjID() constructor can be used to generate a unique object identifier. Such an ObjID is unique over time with respect to the host it is generated on. The ObjID(int) sample code for java.rmi.server.ObjID.ObjID(int) definition code for java.rmi.server.ObjID.ObjID(int) constructor can be used to create a "well-known" object identifier. The scope of a well-known ObjID depends on the RMI runtime it is exported to.

An ObjID instance contains an object number (of type long) and an address space identifier (of type UID sample code for java.rmi.server.UID definition code for java.rmi.server.UID ). In a unique ObjID, the address space identifier is unique with respect to a given host over time. In a well-known ObjID, the address space identifier is equivalent to one returned by invoking the UID.UID(short) sample code for java.rmi.server.UID.UID(short) definition code for java.rmi.server.UID.UID(short) constructor with the value zero.

If the system property java.rmi.server.randomIDs is defined to equal the string "true" (case insensitive), then the ObjID() sample code for java.rmi.server.ObjID.ObjID() definition code for java.rmi.server.ObjID.ObjID() constructor will use a cryptographically strong random number generator to choose the object number of the returned ObjID.

Since:
JDK1.1
See Also:
Serialized Form

Field Summary
static int ACTIVATOR_ID sample code for java.rmi.server.ObjID.ACTIVATOR_ID definition code for java.rmi.server.ObjID.ACTIVATOR_ID
          Object number for well-known ObjID of the activator.
static int DGC_ID sample code for java.rmi.server.ObjID.DGC_ID definition code for java.rmi.server.ObjID.DGC_ID
          Object number for well-known ObjID of the distributed garbage collector.
static int REGISTRY_ID sample code for java.rmi.server.ObjID.REGISTRY_ID definition code for java.rmi.server.ObjID.REGISTRY_ID
          Object number for well-known ObjID of the registry.
 
Constructor Summary
ObjID sample code for java.rmi.server.ObjID.ObjID() definition code for java.rmi.server.ObjID.ObjID() ()
          Generates a unique object identifier.
ObjID sample code for java.rmi.server.ObjID.ObjID(int) definition code for java.rmi.server.ObjID.ObjID(int) (int objNum)
          Creates a "well-known" object identifier.
 
Method Summary
 boolean equals sample code for java.rmi.server.ObjID.equals(java.lang.Object) definition code for java.rmi.server.ObjID.equals(java.lang.Object) (Object sample code for java.lang.Object definition code for java.lang.Object  obj)
          Compares the specified object with this ObjID for equality.
 int hashCode sample code for java.rmi.server.ObjID.hashCode() definition code for java.rmi.server.ObjID.hashCode() ()
          Returns the hash code value for this object identifier, the object number.
static ObjID sample code for java.rmi.server.ObjID definition code for java.rmi.server.ObjID read sample code for java.rmi.server.ObjID.read(java.io.ObjectInput) definition code for java.rmi.server.ObjID.read(java.io.ObjectInput) (ObjectInput sample code for java.io.ObjectInput definition code for java.io.ObjectInput  in)
          Constructs and returns a new ObjID instance by unmarshalling a binary representation from an ObjectInput instance.
 String sample code for java.lang.String definition code for java.lang.String toString sample code for java.rmi.server.ObjID.toString() definition code for java.rmi.server.ObjID.toString() ()
          Returns a string representation of this object identifier.
 void write sample code for java.rmi.server.ObjID.write(java.io.ObjectOutput) definition code for java.rmi.server.ObjID.write(java.io.ObjectOutput) (ObjectOutput sample code for java.io.ObjectOutput definition code for java.io.ObjectOutput  out)
          Marshals a binary representation of this ObjID to an ObjectOutput instance.
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
clone sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() , finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 

Field Detail

REGISTRY_ID sample code for java.rmi.server.ObjID.REGISTRY_ID

public static final int REGISTRY_ID
Object number for well-known ObjID of the registry.

See Also:
Constant Field Values

ACTIVATOR_ID sample code for java.rmi.server.ObjID.ACTIVATOR_ID

public static final int ACTIVATOR_ID
Object number for well-known ObjID of the activator.

See Also:
Constant Field Values

DGC_ID sample code for java.rmi.server.ObjID.DGC_ID

public static final int DGC_ID
Object number for well-known ObjID of the distributed garbage collector.

See Also:
Constant Field Values
Constructor Detail

ObjID sample code for java.rmi.server.ObjID() definition code for java.rmi.server.ObjID()

public ObjID()
Generates a unique object identifier.

If the system property java.rmi.server.randomIDs is defined to equal the string "true" (case insensitive), then this constructor will use a cryptographically strong random number generator to choose the object number of the returned ObjID.


ObjID sample code for java.rmi.server.ObjID(int) definition code for java.rmi.server.ObjID(int)

public ObjID(int objNum)
Creates a "well-known" object identifier.

An ObjID created via this constructor will not clash with any ObjIDs generated via the no-arg constructor.

Parameters:
objNum - object number for well-known object identifier
Method Detail

write sample code for java.rmi.server.ObjID.write(java.io.ObjectOutput) definition code for java.rmi.server.ObjID.write(java.io.ObjectOutput)

public void write(ObjectOutput sample code for java.io.ObjectOutput definition code for java.io.ObjectOutput  out)
           throws IOException sample code for java.io.IOException definition code for java.io.IOException 
Marshals a binary representation of this ObjID to an ObjectOutput instance.

Specifically, this method first invokes the given stream's DataOutput.writeLong(long) sample code for java.io.DataOutput.writeLong(long) definition code for java.io.DataOutput.writeLong(long) method with this object identifier's object number, and then it writes its address space identifier by invoking its UID.write(DataOutput) sample code for java.rmi.server.UID.write(java.io.DataOutput) definition code for java.rmi.server.UID.write(java.io.DataOutput) method with the stream.

Parameters:
out - the ObjectOutput instance to write this ObjID to
Throws:
IOException sample code for java.io.IOException definition code for java.io.IOException - if an I/O error occurs while performing this operation

read sample code for java.rmi.server.ObjID.read(java.io.ObjectInput) definition code for java.rmi.server.ObjID.read(java.io.ObjectInput)

public static ObjID sample code for java.rmi.server.ObjID definition code for java.rmi.server.ObjID  read(ObjectInput sample code for java.io.ObjectInput definition code for java.io.ObjectInput  in)
                  throws IOException sample code for java.io.IOException definition code for java.io.IOException 
Constructs and returns a new ObjID instance by unmarshalling a binary representation from an ObjectInput instance.

Specifically, this method first invokes the given stream's DataInput.readLong() sample code for java.io.DataInput.readLong() definition code for java.io.DataInput.readLong() method to read an object number, then it invokes UID.read(DataInput) sample code for java.rmi.server.UID.read(java.io.DataInput) definition code for java.rmi.server.UID.read(java.io.DataInput) with the stream to read an address space identifier, and then it creates and returns a new ObjID instance that contains the object number and address space identifier that were read from the stream.

Parameters:
in - the ObjectInput instance to read ObjID from
Returns:
unmarshalled ObjID instance
Throws:
IOException sample code for java.io.IOException definition code for java.io.IOException - if an I/O error occurs while performing this operation

hashCode sample code for java.rmi.server.ObjID.hashCode() definition code for java.rmi.server.ObjID.hashCode()

public int hashCode()
Returns the hash code value for this object identifier, the object number.

Overrides:
hashCode sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() in class Object sample code for java.lang.Object definition code for java.lang.Object
Returns:
the hash code value for this object identifier
See Also:
Object.equals(java.lang.Object) sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , Hashtable sample code for java.util.Hashtable definition code for java.util.Hashtable

equals sample code for java.rmi.server.ObjID.equals(java.lang.Object) definition code for java.rmi.server.ObjID.equals(java.lang.Object)

public boolean equals(Object sample code for java.lang.Object definition code for java.lang.Object  obj)
Compares the specified object with this ObjID for equality. This method returns true if and only if the specified object is an ObjID instance with the same object number and address space identifier as this one.

Overrides:
equals sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) in class Object sample code for java.lang.Object definition code for java.lang.Object
Parameters:
obj - the object to compare this ObjID to
Returns:
true if the given object is equivalent to this one, and false otherwise
See Also:
Object.hashCode() sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , Hashtable sample code for java.util.Hashtable definition code for java.util.Hashtable

toString sample code for java.rmi.server.ObjID.toString() definition code for java.rmi.server.ObjID.toString()

public String sample code for java.lang.String definition code for java.lang.String  toString()
Returns a string representation of this object identifier.

Overrides:
toString sample code for java.lang.Object.toString() definition code for java.lang.Object.toString() in class Object sample code for java.lang.Object definition code for java.lang.Object
Returns:
a string representation of this object identifier