|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jgroups.util.UUID
public class UUID
Logical address which is unique over space and time.
Copied from java.util.UUID, but unneeded fields from the latter have been removed. UUIDs needs to
have a small memory footprint.
Field Summary | |
---|---|
protected static LazyRemovalCache<Address,java.lang.String> |
cache
Keeps track of associations between logical addresses (UUIDs) and logical names |
protected long |
leastSigBits
|
protected long |
mostSigBits
|
protected static java.security.SecureRandom |
numberGenerator
The random number generator used by this class to create random based UUIDs |
protected static LazyRemovalCache.Printable<Address,java.lang.String> |
print_function
|
protected static boolean |
print_uuids
|
protected static int |
SIZE
|
Fields inherited from interface org.jgroups.Address |
---|
IP_ADDR, NULL, SITE_MASTER, SITE_UUID, UUID_ADDR |
Constructor Summary | |
---|---|
|
UUID()
|
protected |
UUID(byte[] data)
Private constructor which uses a byte array to construct the new UUID |
|
UUID(long mostSigBits,
long leastSigBits)
|
Method Summary | |
---|---|
static void |
add(Address uuid,
java.lang.String logical_name)
|
static void |
add(java.util.Map<Address,java.lang.String> map)
|
int |
compareTo(Address other)
Compares this UUID with the specified UUID. |
UUID |
copy()
|
protected static java.lang.String |
digits(long val,
int digits)
Returns val represented by the specified number of hex digits. |
boolean |
equals(java.lang.Object obj)
Compares this object to the specified object. |
static java.lang.String |
get(Address logical_addr)
|
static java.util.Map<Address,java.lang.String> |
getContents()
Returns a copy of the cache's contents |
long |
getLeastSignificantBits()
|
long |
getMostSignificantBits()
Returns the most significant 64 bits of this UUID's 128 bit value. |
int |
hashCode()
Returns a hash code for this UUID . |
static java.lang.String |
printCache()
|
static UUID |
randomUUID()
Static factory to retrieve a type 4 (pseudo randomly generated) UUID. |
void |
readExternal(java.io.ObjectInput 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 closed |
static void |
remove(Address addr)
|
static void |
removeAll(java.util.Collection<Address> mbrs)
|
static void |
retainAll(java.util.Collection<Address> logical_addrs)
|
int |
size()
Returns serialized size of this address |
java.lang.String |
toString()
|
java.lang.String |
toStringLong()
Returns a String object representing this UUID . |
void |
writeExternal(java.io.ObjectOutput out)
|
void |
writeTo(java.io.DataOutput out)
Write the entire state of the current object (including superclasses) to outstream. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected long mostSigBits
protected long leastSigBits
protected static volatile java.security.SecureRandom numberGenerator
protected static final LazyRemovalCache<Address,java.lang.String> cache
protected static boolean print_uuids
protected static final int SIZE
protected static final LazyRemovalCache.Printable<Address,java.lang.String> print_function
Constructor Detail |
---|
public UUID()
public UUID(long mostSigBits, long leastSigBits)
protected UUID(byte[] data)
Method Detail |
---|
public static void add(Address uuid, java.lang.String logical_name)
public static void add(java.util.Map<Address,java.lang.String> map)
public static java.lang.String get(Address logical_addr)
public static java.util.Map<Address,java.lang.String> getContents()
public static void remove(Address addr)
public static void removeAll(java.util.Collection<Address> mbrs)
public static void retainAll(java.util.Collection<Address> logical_addrs)
public static java.lang.String printCache()
public static UUID randomUUID()
UUID
is generated using a cryptographically strong pseudo
random number generator.
UUID
public long getLeastSignificantBits()
public long getMostSignificantBits()
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toStringLong()
String
object representing this UUID
.
The UUID string representation is as described by this BNF:
UUID = <time_low> "-" <time_mid> "-" <time_high_and_version> "-" <variant_and_sequence> "-" <node> time_low = 4*<hexOctet> time_mid = 2*<hexOctet> time_high_and_version = 2*<hexOctet> variant_and_sequence = 2*<hexOctet> node = 6*<hexOctet> hexOctet = <hexDigit><hexDigit> hexDigit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "a" | "b" | "c" | "d" | "e" | "f" | "A" | "B" | "C" | "D" | "E" | "F"
UUID
protected static java.lang.String digits(long val, int digits)
public int hashCode()
UUID
.
hashCode
in class java.lang.Object
UUID
public boolean equals(java.lang.Object obj)
true
if and only if the argument is not null
, is a UUID
object, has the same variant, and contains the same value, bit for bit,
as this UUID
.
equals
in class java.lang.Object
obj
- The object to be compared
true
if the objects are the same; false
otherwisepublic int compareTo(Address other)
The first of two UUIDs is greater than the second if the most significant field in which the UUIDs differ is greater for the first UUID.
compareTo
in interface java.lang.Comparable<Address>
other
- UUID
to which this UUID
is to be compared
UUID
is less than, equal to, or greater than val
public void writeTo(java.io.DataOutput out) throws java.lang.Exception
Streamable
writeTo
in interface Streamable
java.lang.Exception
public void readFrom(java.io.DataInput in) throws java.lang.Exception
Streamable
readFrom
in interface Streamable
java.lang.Exception
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
writeExternal
in interface java.io.Externalizable
java.io.IOException
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException
readExternal
in interface java.io.Externalizable
java.io.IOException
java.lang.ClassNotFoundException
public int size()
Address
size
in interface Address
public UUID copy()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |