Package org.jgroups.util
Class ExtendedUUID
- java.lang.Object
-
- org.jgroups.util.UUID
-
- org.jgroups.util.FlagsUUID
-
- org.jgroups.util.ExtendedUUID
-
- All Implemented Interfaces:
java.lang.Comparable<Address>
,Address
,Constructable<UUID>
,SizeStreamable
,Streamable
- Direct Known Subclasses:
SiteUUID
public class ExtendedUUID extends FlagsUUID
Subclass ofUUID
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
- Author:
- Bela Ban
-
-
Field Summary
Fields Modifier and Type Field Description protected byte[][]
keys
protected static java.util.function.Function<ExtendedUUID,java.lang.String>
print_function
protected byte[][]
values
-
Fields inherited from class org.jgroups.util.UUID
leastSigBits, mostSigBits, SIZE
-
-
Constructor Summary
Constructors Modifier Constructor Description ExtendedUUID()
protected
ExtendedUUID(byte[] data)
ExtendedUUID(long mostSigBits, long leastSigBits)
ExtendedUUID(T o)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description <T extends FlagsUUID>
TaddContents(T o)
java.util.function.Supplier<? extends UUID>
create()
Creates an instance of the class implementing this interfacebyte[]
get(byte[] key)
byte[]
get(java.lang.String key)
boolean
keyExists(byte[] key)
boolean
keyExists(java.lang.String key)
int
length()
The number of non-null keysjava.lang.String
print()
ExtendedUUID
put(byte[] key, byte[] val)
protected ExtendedUUID
put(int start_index, byte[] key, byte[] val)
ExtendedUUID
put(java.lang.String key, byte[] val)
static ExtendedUUID
randomUUID()
static ExtendedUUID
randomUUID(java.lang.String name)
protected void
read(java.io.DataInput in)
void
readFrom(java.io.DataInput in)
Read the state of the current object (including superclasses) from instream Note that the input stream must not be closedbyte[]
remove(byte[] key)
byte[]
remove(java.lang.String key)
protected void
resize(int new_length)
int
serializedSize()
The number of bytes required to serialize this instancestatic void
setPrintFunction(java.util.function.Function<ExtendedUUID,java.lang.String> f)
protected int
sizeofHashMap()
java.lang.String
toString()
protected void
write(java.io.DataOutput out)
void
writeTo(java.io.DataOutput out)
Write the entire state of the current object (including superclasses) to outstream.-
Methods inherited from class org.jgroups.util.UUID
compareTo, copy, digits, equals, fromString, generateRandomBytes, getLeastSignificantBits, getMostSignificantBits, hashCode, printName, toStringLong
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.jgroups.Address
isMulticast, isSiteAddress, isSiteMaster
-
-
-
-
Field Detail
-
keys
protected byte[][] keys
-
values
protected byte[][] values
-
print_function
protected static java.util.function.Function<ExtendedUUID,java.lang.String> print_function
-
-
Method Detail
-
create
public java.util.function.Supplier<? extends UUID> create()
Description copied from interface:Constructable
Creates an instance of the class implementing this interface- Specified by:
create
in interfaceConstructable<UUID>
- Overrides:
create
in classFlagsUUID
-
setPrintFunction
public static void setPrintFunction(java.util.function.Function<ExtendedUUID,java.lang.String> f)
-
randomUUID
public static ExtendedUUID randomUUID()
-
randomUUID
public static ExtendedUUID randomUUID(java.lang.String name)
-
get
public byte[] get(byte[] key)
-
get
public byte[] get(java.lang.String key)
-
put
public ExtendedUUID put(byte[] key, byte[] val)
-
put
protected ExtendedUUID put(int start_index, byte[] key, byte[] val)
-
put
public ExtendedUUID put(java.lang.String key, byte[] val)
-
remove
public byte[] remove(byte[] key)
-
remove
public byte[] remove(java.lang.String key)
-
keyExists
public boolean keyExists(byte[] key)
-
keyExists
public boolean keyExists(java.lang.String key)
-
addContents
public <T extends FlagsUUID> T addContents(T o)
- Overrides:
addContents
in classFlagsUUID
-
writeTo
public void writeTo(java.io.DataOutput 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 interfaceStreamable
- Overrides:
writeTo
in classFlagsUUID
- Throws:
java.io.IOException
-
readFrom
public void readFrom(java.io.DataInput in) throws java.io.IOException
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 interfaceStreamable
- Overrides:
readFrom
in classFlagsUUID
- Throws:
java.io.IOException
-
serializedSize
public int serializedSize()
The number of bytes required to serialize this instance- Specified by:
serializedSize
in interfaceSizeStreamable
- Overrides:
serializedSize
in classFlagsUUID
-
length
public int length()
The number of non-null keys
-
print
public java.lang.String print()
-
write
protected void write(java.io.DataOutput out) throws java.io.IOException
- Throws:
java.io.IOException
-
read
protected void read(java.io.DataInput in) throws java.io.IOException
- Throws:
java.io.IOException
-
sizeofHashMap
protected int sizeofHashMap()
-
resize
protected void resize(int new_length)
-
-