java.rmi.dgc
Class VMID

java.lang.Object
  extended by java.rmi.dgc.VMID
All Implemented Interfaces:
Serializable

public final class VMID
extends Object
implements Serializable

An identifier that is unique accross the all virtual machines. This class is used by distributed garbage collector to identify the virtual machine of the client, but may also be used in various other cases, when such identifier is required. This class separately stores and transfers the host IP address, but will try to do its best also for the case if it failed to determine it. The alternative algorithms are used in UID that is part of this class. The VMID's, created on the same host, but in the two separately (parallely) running virtual machines are different.

See Also:
Serialized Form

Constructor Summary
VMID()
          Create the new VMID.
 
Method Summary
 boolean equals(Object obj)
          Returns true if the passed parameter is also VMID and it is equal to this VMID.
 int hashCode()
          Get the hash code of this VMID.
static boolean isUnique()
          Deprecated. VMID's are more or less always reliable.
 String toString()
          Get the string representation of this VMID.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

VMID

public VMID()
Create the new VMID. All VMID's are unique accross tha all virtual machines.

Method Detail

isUnique

public static boolean isUnique()
Deprecated. VMID's are more or less always reliable.

Return true if it is possible to get the accurate address of this host. If false is returned, the created VMID's are less reliable, but the starting time and possibly the memory allocation are also taken into consideration in the incorporated UID. Hence the VMID's, created on the different virtual machines, still should be different.

Returns:
false if the local host ip address is 127.0.0.1 or unknown, true otherwise.

hashCode

public int hashCode()
Get the hash code of this VMID.

Overrides:
hashCode in class Object
Returns:
the hash code for this Object
See Also:
Object.equals(Object), System.identityHashCode(Object)

equals

public boolean equals(Object obj)
Returns true if the passed parameter is also VMID and it is equal to this VMID. The VMID should only be equal to itself (also if the passed value is another instance, cloned by serialization).

Overrides:
equals in class Object
Parameters:
obj - the Object to compare to
Returns:
whether this Object is semantically equal to another
See Also:
Object.hashCode()

toString

public String toString()
Get the string representation of this VMID.

Overrides:
toString in class Object
Returns:
the String representing this Object, which may be null
See Also:
Object.getClass(), Object.hashCode(), Class.getName(), Integer.toHexString(int)