org.jboss.util.id
Class VMID

java.lang.Object
  extended byorg.jboss.util.id.VMID
All Implemented Interfaces:
java.lang.Cloneable, ID (src) , java.io.Serializable

public class VMID
extends java.lang.Object
implements ID (src)

An object that uniquely identifies a virtual machine.

The identifier is composed of:

  1. The Internet address of the physical machine.
  2. The process identifier of the virtual machine.
  3. A UID to guarantee uniqness across multipule virtual machines on the same physical machine.
    [ address ] - [ process id ] - [ time ] - [ counter ]
                                   |------- UID --------|
 

Numbers are converted to radix(Character.MAX_RADIX) when converting to strings.

See Also:
UID (src) , Serialized Form

Field Summary
protected  byte[] address
          The address of the current virtual machine
protected  int hashCode
          The hash code of this VMID
protected  PID (src) pid
          The process identifier of the current virtual machine
protected  UID (src) uid
          A unique identifier to ensure uniqueness across the host machine
static byte[] UNKNOWN_HOST
          The address used when conventional methods fail to return the address of the current machine.
 
Constructor Summary
protected VMID(byte[] address, PID (src)  pid, UID (src)  uid)
          Construct a new VMID.
protected VMID(VMID (src)  vmid)
          Copy a VMID.
 
Method Summary
static java.lang.String asString()
          Returns a VMID as a string.
 java.lang.Object clone()
          Returns a copy of this VMID.
 boolean equals(java.lang.Object obj)
          Check if the given object is equal to this VMID.
 byte[] getAddress()
          Get the address portion of this VMID.
static VMID (src) getInstance()
          Get the VMID for the current virtual machine.
 PID (src) getProcessID()
          Get the process identifier portion of this VMID.
 UID (src) getUID()
          Get the UID portion of this VMID.
 int hashCode()
          Return the hash code of this VMID.
 java.lang.String toString()
          Return a string representation of this VMID.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

address

protected final byte[] address
The address of the current virtual machine


pid

protected final PID (src)  pid
The process identifier of the current virtual machine


uid

protected final UID (src)  uid
A unique identifier to ensure uniqueness across the host machine


hashCode

protected final int hashCode
The hash code of this VMID


UNKNOWN_HOST

public static final byte[] UNKNOWN_HOST
The address used when conventional methods fail to return the address of the current machine.

Constructor Detail

VMID

protected VMID(byte[] address,
               PID (src)  pid,
               UID (src)  uid)
Construct a new VMID.

Parameters:
address - The address of the current virtual machine.
pid - Process identifier.
uid - Unique identifier.
See Also:
For getting a VMID instance reference.

VMID

protected VMID(VMID (src)  vmid)
Copy a VMID.

Parameters:
vmid - VMID to copy.
Method Detail

getAddress

public final byte[] getAddress()
Get the address portion of this VMID.

Returns:
The address portion of this VMID.

getProcessID

public final PID (src)  getProcessID()
Get the process identifier portion of this VMID.

Returns:
The process identifier portion of this VMID.

getUID

public final UID (src)  getUID()
Get the UID portion of this VMID.

Returns:
The UID portion of this VMID.

toString

public java.lang.String toString()
Return a string representation of this VMID.

Returns:
A string representation of this VMID.

hashCode

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

Returns:
The hash code of this VMID.

equals

public boolean equals(java.lang.Object obj)
Check if the given object is equal to this VMID.

A VMID is equals to another VMID if the address, process identifer and UID portions are equal.

Parameters:
obj - Object to test equality with.
Returns:
True if object is equals to this VMID.

clone

public java.lang.Object clone()
Returns a copy of this VMID.

Returns:
A copy of this VMID.

asString

public static java.lang.String asString()
Returns a VMID as a string.

Returns:
VMID as a string.

getInstance

public static VMID (src)  getInstance()
Get the VMID for the current virtual machine.

Returns:
Virtual machine identifier.
Throws:
NestedError - Failed to create VMID instance.