public class TopologyUUID extends UUID
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).Modifier and Type | Field and Description |
---|---|
protected String |
machine_id |
protected String |
rack_id |
protected String |
site_id |
additional_data, cache, leastSigBits, mostSigBits, numberGenerator, print_function, print_uuids, SIZE
Modifier | Constructor and Description |
---|---|
|
TopologyUUID() |
protected |
TopologyUUID(byte[] data,
String site_id,
String rack_id,
String machine_id) |
Modifier and Type | Method and Description |
---|---|
protected static byte[] |
generateRandomBytes() |
String |
getMachineId() |
String |
getRackId() |
String |
getSiteId() |
boolean |
isSameMachine(TopologyUUID addr) |
boolean |
isSameRack(TopologyUUID addr) |
boolean |
isSameSite(TopologyUUID addr) |
protected String |
printDetails() |
static TopologyUUID |
randomUUID(String site_id,
String rack_id,
String machine_id) |
static TopologyUUID |
randomUUID(String logical_name,
String site_id,
String rack_id,
String machine_id) |
void |
readExternal(ObjectInput in) |
void |
readFrom(DataInputStream in)
Read the state of the current object (including superclasses) from instream
Note that the input stream must not be closed
|
void |
setMachineId(String machine_id) |
void |
setRackId(String rack_id) |
void |
setSiteId(String site_id) |
int |
size()
Returns serialized size of this address
|
String |
toString() |
String |
toStringDetailed() |
void |
writeExternal(ObjectOutput out) |
void |
writeTo(DataOutputStream out)
Write the entire state of the current object (including superclasses) to outstream.
|
add, add, clone, compareTo, digits, equals, get, getAdditionalData, getContents, getLeastSignificantBits, getMostSignificantBits, hashCode, isMulticastAddress, printCache, randomUUID, remove, removeAll, retainAll, setAdditionalData, toStringLong
protected String site_id
protected String rack_id
protected String machine_id
public static TopologyUUID randomUUID(String site_id, String rack_id, String machine_id)
public static TopologyUUID randomUUID(String logical_name, String site_id, String rack_id, String machine_id)
public String getSiteId()
public void setSiteId(String site_id)
public String getRackId()
public void setRackId(String rack_id)
public String getMachineId()
public void setMachineId(String machine_id)
public boolean isSameSite(TopologyUUID addr)
public boolean isSameRack(TopologyUUID addr)
public boolean isSameMachine(TopologyUUID addr)
public int size()
Address
public void writeTo(DataOutputStream out) throws IOException
Streamable
writeTo
in interface Streamable
writeTo
in class UUID
IOException
public void readFrom(DataInputStream in) throws IOException, IllegalAccessException, InstantiationException
Streamable
readFrom
in interface Streamable
readFrom
in class UUID
IOException
IllegalAccessException
InstantiationException
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal
in interface Externalizable
readExternal
in class UUID
IOException
ClassNotFoundException
public void writeExternal(ObjectOutput out) throws IOException
writeExternal
in interface Externalizable
writeExternal
in class UUID
IOException
public String toStringDetailed()
protected static byte[] generateRandomBytes()
protected String printDetails()
Copyright © 2013 JBoss, a division of Red Hat. All Rights Reserved.