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.Comparable<Address>, Address, Streamable
- Direct Known Subclasses:
- CanBeSiteMasterTopology
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
|
Constructor Summary |
|
TopologyUUID()
|
protected |
TopologyUUID(byte[] data,
java.lang.String site_id,
java.lang.String rack_id,
java.lang.String machine_id)
|
protected |
TopologyUUID(long most_sig_bits,
long least_sig_bits,
java.lang.String site_id,
java.lang.String rack_id,
java.lang.String machine_id)
|
Methods inherited from class org.jgroups.util.UUID |
add, add, compareTo, copy, digits, equals, get, getContents, getLeastSignificantBits, getMostSignificantBits, hashCode, printCache, randomUUID, remove, removeAll, retainAll, toStringLong |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
site_id
protected java.lang.String site_id
rack_id
protected java.lang.String rack_id
machine_id
protected java.lang.String machine_id
TopologyUUID
public TopologyUUID()
TopologyUUID
protected TopologyUUID(byte[] data,
java.lang.String site_id,
java.lang.String rack_id,
java.lang.String machine_id)
TopologyUUID
protected TopologyUUID(long most_sig_bits,
long least_sig_bits,
java.lang.String site_id,
java.lang.String rack_id,
java.lang.String machine_id)
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.DataOutput out)
throws java.lang.Exception
- 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.lang.Exception
readFrom
public void readFrom(java.io.DataInput in)
throws java.lang.Exception
- 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.lang.Exception
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-2012 Bela Ban / Red Hat. All Rights Reserved.