## org.jgroups.util
Class TopologyUUID

    java.lang.Object
      org.jgroups.util.UUID
          org.jgroups.util.TopologyUUID

All Implemented Interfaces:
  java.io.Externalizable, java.io.Serializable, java.lang.Cloneable, java.lang.Comparable<Address>, Address, Streamable

    public class TopologyUUID

extends UUID

Subclass of `UUID` which adds 3 strings (siteId, rackId and machineId)as payload. An instance of this can be fed to `JChannel.setAddressGenerator(org.jgroups.stack.AddressGenerator)`, with the address generator creating TopologyUUIDs.

Mainly used by TopologyAwareConsistentHash in Infinispan (www.infinispan.org).

Author:
  Bela Ban
See Also:
  Serialized Form

Field Summary
`protected java.lang.String` `machine_id`
`protected java.lang.String` `rack_id`
`protected java.lang.String` `site_id`

Fields inherited from class org.jgroups.util.UUID
`additional_data, cache, leastSigBits, mostSigBits, numberGenerator, print_function, print_uuids, SIZE`

Fields inherited from interface org.jgroups.Address
`IP_ADDR, NULL, UUID_ADDR`

Constructor Summary
`` `TopologyUUID()`
`protected` `TopologyUUID(byte[] data, java.lang.String site_id, java.lang.String rack_id, java.lang.String machine_id)`

Method Summary
`protected static byte[]` `generateRandomBytes()`
`java.lang.String` `getMachineId()`
`java.lang.String` `getRackId()`
`java.lang.String` `getSiteId()`
`boolean` `isSameMachine(TopologyUUID addr)`
`boolean` `isSameRack(TopologyUUID addr)`
`boolean` `isSameSite(TopologyUUID addr)`
`protected java.lang.String` `printDetails()`
`static TopologyUUID` `randomUUID(java.lang.String site_id, java.lang.String rack_id, java.lang.String machine_id)`
`static TopologyUUID` `randomUUID(java.lang.String logical_name, java.lang.String site_id, java.lang.String rack_id, java.lang.String machine_id)`
`void` `readExternal(java.io.ObjectInput in)`
`void` `readFrom(java.io.DataInputStream in)` Read the state of the current object (including superclasses) from instream Note that the input stream must not be closed
`void` `setMachineId(java.lang.String machine_id)`
`void` `setRackId(java.lang.String rack_id)`
`void` `setSiteId(java.lang.String site_id)`
`int` `size()` Returns serialized size of this address
`java.lang.String` `toString()`
`java.lang.String` `toStringDetailed()`
`void` `writeExternal(java.io.ObjectOutput out)`
`void` `writeTo(java.io.DataOutputStream out)` Write the entire state of the current object (including superclasses) to outstream.

Methods inherited from class org.jgroups.util.UUID
`add, add, clone, compareTo, digits, equals, get, getAdditionalData, getContents, getLeastSignificantBits, getMostSignificantBits, hashCode, isMulticastAddress, printCache, randomUUID, remove, removeAll, retainAll, setAdditionalData, toStringLong`

Methods inherited from class java.lang.Object
`finalize, getClass, notify, notifyAll, wait, wait, wait`

Field Detail

### site_id

    protected java.lang.String site_id

### rack_id

    protected java.lang.String rack_id

### machine_id

    protected java.lang.String machine_id

Constructor Detail

### TopologyUUID

    public TopologyUUID()

### TopologyUUID

    protected TopologyUUID(byte[] data,
                           java.lang.String site_id,
                           java.lang.String rack_id,
                           java.lang.String machine_id)

Method Detail

### randomUUID

    public static TopologyUUID randomUUID(java.lang.String site_id,
                                          java.lang.String rack_id,
                                          java.lang.String machine_id)

### randomUUID

    public static TopologyUUID randomUUID(java.lang.String logical_name,
                                          java.lang.String site_id,
                                          java.lang.String rack_id,
                                          java.lang.String machine_id)

### getSiteId

    public java.lang.String getSiteId()

### setSiteId

    public void setSiteId(java.lang.String site_id)

### getRackId

    public java.lang.String getRackId()

### setRackId

    public void setRackId(java.lang.String rack_id)

### getMachineId

    public java.lang.String getMachineId()

### setMachineId

    public void setMachineId(java.lang.String machine_id)

### isSameSite

    public boolean isSameSite(TopologyUUID addr)

### isSameRack

    public boolean isSameRack(TopologyUUID addr)

### isSameMachine

    public boolean isSameMachine(TopologyUUID addr)

### size

    public int size()

  Description copied from interface: `Address`
  Returns serialized size of this address

  Specified by:
    `size` in interface `Address`
  Overrides:
    `size` in class `UUID`

### writeTo

    public void writeTo(java.io.DataOutputStream out)
                 throws java.io.IOException

  Description copied from interface: `Streamable`
  Write the entire state of the current object (including superclasses) to outstream. Note that the output stream must not be closed

  Specified by:
    `writeTo` in interface `Streamable`
  Overrides:
    `writeTo` in class `UUID`
  Throws:
    `java.io.IOException`

### readFrom

    public void readFrom(java.io.DataInputStream in)
                  throws java.io.IOException,
                         java.lang.IllegalAccessException,
                         java.lang.InstantiationException

  Description copied from interface: `Streamable`
  Read the state of the current object (including superclasses) from instream Note that the input stream must not be closed

  Specified by:
    `readFrom` in interface `Streamable`
  Overrides:
    `readFrom` in class `UUID`
  Throws:
    `java.io.IOException`
    `java.lang.IllegalAccessException`
    `java.lang.InstantiationException`

### readExternal

    public void readExternal(java.io.ObjectInput in)
                      throws java.io.IOException,
                             java.lang.ClassNotFoundException

  Specified by:
    `readExternal` in interface `java.io.Externalizable`
  Overrides:
    `readExternal` in class `UUID`
  Throws:
    `java.io.IOException`
    `java.lang.ClassNotFoundException`

### writeExternal

    public void writeExternal(java.io.ObjectOutput out)
                       throws java.io.IOException

  Specified by:
    `writeExternal` in interface `java.io.Externalizable`
  Overrides:
    `writeExternal` in class `UUID`
  Throws:
    `java.io.IOException`

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `UUID`

### toStringDetailed

    public java.lang.String toStringDetailed()

### generateRandomBytes

    protected static byte[] generateRandomBytes()

### printDetails

    protected java.lang.String printDetails()

Copyright © 1998-2009 Bela Ban / Red Hat. All Rights Reserved.