Package org.jgroups.util
Class ExtendedUUID
java.lang.Object
org.jgroups.util.UUID
org.jgroups.util.FlagsUUID
org.jgroups.util.ExtendedUUID
- All Implemented Interfaces:
Comparable<Address>,Address,Constructable<UUID>,SizeStreamable,Streamable
- Direct Known Subclasses:
SiteUUID
Subclass of
UUID accommodating additional data such as a flag and a small hashmap. There may be many instances
in memory, and as they are serialized a lot and sent across the wire, I tried to make this as compact as possible.
As a consequence, the hashmap can have a max size of 255 and a value can have a max length of 255 bytes.- Since:
- 3.5
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected byte[][]protected static Function<ExtendedUUID, String> protected byte[][]Fields inherited from class org.jgroups.util.UUID
leastSigBits, mostSigBits, SIZE -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedExtendedUUID(byte[] data) ExtendedUUID(long mostSigBits, long leastSigBits) ExtendedUUID(T o) -
Method Summary
Modifier and TypeMethodDescription<T extends FlagsUUID>
TaddContents(T o) create()Creates an instance of the class implementing this interfacebyte[]get(byte[] key) byte[]booleankeyExists(byte[] key) booleanintlength()The number of non-null keysprint()put(byte[] key, byte[] val) protected ExtendedUUIDput(int start_index, byte[] key, byte[] val) static ExtendedUUIDstatic ExtendedUUIDrandomUUID(String name) protected voidvoidRead the state of the current object (including superclasses) from instream Note that the input stream must not be closedbyte[]remove(byte[] key) byte[]protected voidresize(int new_length) intThe number of bytes required to serialize this instancestatic voidprotected inttoString()protected voidwrite(DataOutput out) voidwriteTo(DataOutput out) Write the entire state of the current object (including superclasses) to outstream.Methods inherited from class org.jgroups.util.UUID
compareTo, compareTo, copy, digits, equals, fromString, generateRandomBytes, getLeastSignificantBits, getMostSignificantBits, hashCode, printName, toStringLongMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.jgroups.Address
isMulticast, isSiteAddress, isSiteMaster
-
Field Details
-
keys
protected byte[][] keys -
values
protected byte[][] values -
print_function
-
-
Constructor Details
-
ExtendedUUID
public ExtendedUUID() -
ExtendedUUID
protected ExtendedUUID(byte[] data) -
ExtendedUUID
public ExtendedUUID(long mostSigBits, long leastSigBits) -
ExtendedUUID
public ExtendedUUID(T o)
-
-
Method Details
-
create
Description copied from interface:ConstructableCreates an instance of the class implementing this interface- Specified by:
createin interfaceConstructable<UUID>- Overrides:
createin classFlagsUUID
-
setPrintFunction
-
randomUUID
-
randomUUID
-
get
public byte[] get(byte[] key) -
get
-
put
-
put
-
put
-
remove
public byte[] remove(byte[] key) -
remove
-
keyExists
public boolean keyExists(byte[] key) -
keyExists
-
addContents
- Overrides:
addContentsin classFlagsUUID
-
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 classFlagsUUID- Throws:
IOException
-
readFrom
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 classFlagsUUID- Throws:
IOException
-
serializedSize
public int serializedSize()The number of bytes required to serialize this instance- Specified by:
serializedSizein interfaceSizeStreamable- Overrides:
serializedSizein classFlagsUUID
-
length
public int length()The number of non-null keys -
toString
-
print
-
write
- Throws:
IOException
-
read
- Throws:
IOException
-
sizeofHashMap
protected int sizeofHashMap() -
resize
protected void resize(int new_length)
-