Package org.apache.ignite.lang
Class IgniteUuid
- java.lang.Object
-
- org.apache.ignite.lang.IgniteUuid
-
- All Implemented Interfaces:
Externalizable,Serializable,Cloneable,Comparable<IgniteUuid>,Iterable<IgniteUuid>,Binarylizable
public final class IgniteUuid extends Object implements Comparable<IgniteUuid>, Iterable<IgniteUuid>, Cloneable, Externalizable, Binarylizable
This is a faster performing version ofUUID. On basic tests this version is at least 10x time faster for ID creation. It uses extra memory for 8-byte counter additionally to internal UUID.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description IgniteUuid()Empty constructor required forExternalizable.IgniteUuid(UUID gid, long locId)ConstructsIgniteUuidfrom a global and local identifiers.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Objectclone()intcompareTo(IgniteUuid o)booleanequals(Object obj)static IgniteUuidfromString(String s)Converts string intoIgniteUuid.static IgniteUuidfromUuid(UUID id)Constructs newIgniteUuidbased on global and local ID portions.UUIDglobalId()Gets global ID portion of thisIgniteUuid.inthashCode()org.apache.ignite.internal.util.lang.GridIterator<IgniteUuid>iterator()static longlastLocalId()Gets last generated local ID.longlocalId()Gets local ID portion of thisIgniteUuid.static IgniteUuidrandomUuid()Creates new pseudo-random ID.voidreadBinary(BinaryReader reader)Reads fields from provided reader.voidreadExternal(ObjectInput in)StringshortString()Gets a short string version of this ID.StringtoString()static UUIDvmId()GetsUUIDassociated with local VM.voidwriteBinary(BinaryWriter writer)Writes fields to provided writer.voidwriteExternal(ObjectOutput out)-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Field Detail
-
VM_ID
public static final UUID VM_ID
VM ID.
-
-
Constructor Detail
-
IgniteUuid
public IgniteUuid()
Empty constructor required forExternalizable.
-
IgniteUuid
public IgniteUuid(UUID gid, long locId)
ConstructsIgniteUuidfrom a global and local identifiers.- Parameters:
gid- UUID.locId- Counter.
-
-
Method Detail
-
vmId
public static UUID vmId()
GetsUUIDassociated with local VM.- Returns:
UUIDassociated with local VM.
-
lastLocalId
public static long lastLocalId()
Gets last generated local ID.- Returns:
- Last generated local ID.
-
randomUuid
public static IgniteUuid randomUuid()
Creates new pseudo-random ID.- Returns:
- Newly created pseudo-random ID.
-
fromUuid
public static IgniteUuid fromUuid(UUID id)
Constructs newIgniteUuidbased on global and local ID portions.- Parameters:
id- UUID instance.- Returns:
- Newly created pseudo-random ID.
-
fromString
public static IgniteUuid fromString(String s)
Converts string intoIgniteUuid. The String must be in the format generated bytoString()method.- Parameters:
s- String to convert toIgniteUuid.- Returns:
IgniteUuidinstance representing given string.
-
shortString
public String shortString()
Gets a short string version of this ID. Use it only for UI where full version is available to the application.- Returns:
- Short string version of this ID.
-
globalId
public UUID globalId()
Gets global ID portion of thisIgniteUuid.- Returns:
- Global ID portion of this
IgniteUuid.
-
localId
public long localId()
Gets local ID portion of thisIgniteUuid.- Returns:
- Local ID portion of this
IgniteUuid.
-
writeExternal
public void writeExternal(ObjectOutput out) throws IOException
- Specified by:
writeExternalin interfaceExternalizable- Throws:
IOException
-
readExternal
public void readExternal(ObjectInput in) throws IOException
- Specified by:
readExternalin interfaceExternalizable- Throws:
IOException
-
compareTo
public int compareTo(IgniteUuid o)
- Specified by:
compareToin interfaceComparable<IgniteUuid>
-
iterator
public org.apache.ignite.internal.util.lang.GridIterator<IgniteUuid> iterator()
- Specified by:
iteratorin interfaceIterable<IgniteUuid>
-
writeBinary
public void writeBinary(BinaryWriter writer) throws BinaryObjectException
Writes fields to provided writer.- Specified by:
writeBinaryin interfaceBinarylizable- Parameters:
writer- Binary object writer.- Throws:
BinaryObjectException- In case of error.
-
readBinary
public void readBinary(BinaryReader reader) throws BinaryObjectException
Reads fields from provided reader.- Specified by:
readBinaryin interfaceBinarylizable- Parameters:
reader- Binary object reader.- Throws:
BinaryObjectException- In case of error.
-
clone
public Object clone() throws CloneNotSupportedException
- Overrides:
clonein classObject- Throws:
CloneNotSupportedException
-
-