Package org.jgroups.util
Class TopologyUUID
java.lang.Object
org.jgroups.util.UUID
org.jgroups.util.TopologyUUID
- All Implemented Interfaces:
Externalizable,Serializable,Cloneable,Comparable<Address>,Address,Streamable
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:
-
Field Summary
FieldsFields inherited from class org.jgroups.util.UUID
additional_data, cache, leastSigBits, mostSigBits, numberGenerator, print_function, print_uuids, SIZE -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedTopologyUUID(byte[] data, String site_id, String rack_id, String machine_id) -
Method Summary
Modifier and TypeMethodDescriptionprotected static byte[]booleanisSameMachine(TopologyUUID addr) booleanisSameRack(TopologyUUID addr) booleanisSameSite(TopologyUUID addr) protected Stringstatic TopologyUUIDrandomUUID(String site_id, String rack_id, String machine_id) static TopologyUUIDrandomUUID(String logical_name, String site_id, String rack_id, String machine_id) voidvoidRead the state of the current object (including superclasses) from instream Note that the input stream must not be closedvoidsetMachineId(String machine_id) voidvoidintsize()Returns serialized size of this addresstoString()voidvoidwriteTo(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
-
Field Details
-
site_id
-
rack_id
-
machine_id
-
-
Constructor Details
-
TopologyUUID
public TopologyUUID() -
TopologyUUID
-
-
Method Details
-
randomUUID
-
randomUUID
public static TopologyUUID randomUUID(String logical_name, String site_id, String rack_id, String machine_id) -
getSiteId
-
setSiteId
-
getRackId
-
setRackId
-
getMachineId
-
setMachineId
-
isSameSite
-
isSameRack
-
isSameMachine
-
size
public int size()Description copied from interface:AddressReturns serialized size of this address -
writeTo
Description copied from interface:StreamableWrite the entire state of the current object (including superclasses) to outstream. Note that the output stream must not be closed- Specified by:
writeToin interfaceStreamable- Overrides:
writeToin classUUID- Throws:
IOException
-
readFrom
public void readFrom(DataInputStream in) throws IOException, IllegalAccessException, InstantiationException Description copied from interface:StreamableRead the state of the current object (including superclasses) from instream Note that the input stream must not be closed- Specified by:
readFromin interfaceStreamable- Overrides:
readFromin classUUID- Throws:
IOExceptionIllegalAccessExceptionInstantiationException
-
readExternal
- Specified by:
readExternalin interfaceExternalizable- Overrides:
readExternalin classUUID- Throws:
IOExceptionClassNotFoundException
-
writeExternal
- Specified by:
writeExternalin interfaceExternalizable- Overrides:
writeExternalin classUUID- Throws:
IOException
-
toString
-
toStringDetailed
-
generateRandomBytes
protected static byte[] generateRandomBytes() -
printDetails
-