jgroup.relacs.types
Class VMIDImpl

java.lang.Object
  extended by jgroup.relacs.types.VMIDImpl
All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable, VMID

public final class VMIDImpl
extends java.lang.Object
implements VMID

The VMIDImpl class implements the VMID interface to uniquely identify a Java Virtual Machine.

Since:
Jgroup 0.7
Author:
Alberto Montresor, Hein Meling
See Also:
Serialized Form

Constructor Summary
VMIDImpl()
          Public default constructor for externalization.
 
Method Summary
 boolean equals(java.lang.Object obj)
          Compares two objects for content equality.
 java.net.InetAddress getAddress()
          Returns the address of the host in which the virtual machine identified by this VMID is executed.
static VMID getLocalVMID()
          Returns the VMID for the local Java Virtual Machine.
 long getTime()
          Returns the time at which this VMID has been created.
 int hashCode()
          Returns a hashcode for the VMIDImpl.
 void readExternal(java.io.ObjectInput in)
          Restores the content of this object from the marshalled data contained in the specified input stream.
 java.lang.String toString()
          Returns a string representation of this object.
 void writeExternal(java.io.ObjectOutput out)
          Write the content of this VMID on stream out.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

VMIDImpl

public VMIDImpl()
Public default constructor for externalization.

Method Detail

getLocalVMID

public static VMID getLocalVMID()
Returns the VMID for the local Java Virtual Machine.


getAddress

public java.net.InetAddress getAddress()
                                throws java.net.UnknownHostException
Returns the address of the host in which the virtual machine identified by this VMID is executed.

Specified by:
getAddress in interface VMID
Throws:
java.net.UnknownHostException

getTime

public long getTime()
Returns the time at which this VMID has been created.

Specified by:
getTime in interface VMID

toString

public java.lang.String toString()
Returns a string representation of this object.

Overrides:
toString in class java.lang.Object

hashCode

public int hashCode()
Returns a hashcode for the VMIDImpl. Two VMIDImpls will have the same hashcode if they are equal with respect to their content.

Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Compares two objects for content equality.

Overrides:
equals in class java.lang.Object
Parameters:
obj - the object to compare with
Returns:
true if these objects are equal; false otherwise.

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Write the content of this VMID on stream out. Note that the InetAddress is not serialized, because too inefficient. If requested, the InetAddress is retrieved through DNS lookup in method getAddress.

Specified by:
writeExternal in interface java.io.Externalizable
Parameters:
out - the stream to be written
Throws:
java.io.IOException

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException
Restores the content of this object from the marshalled data contained in the specified input stream.

Specified by:
readExternal in interface java.io.Externalizable
Parameters:
in - the stream to be read
Throws:
java.io.IOException


Copyright © 1998-2006 The Jgroup/ARM development team. All Rights Reserved.