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)
ConstructsIgniteUuid
from a global and local identifiers.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Object
clone()
int
compareTo(IgniteUuid o)
boolean
equals(Object obj)
static IgniteUuid
fromString(String s)
Converts string intoIgniteUuid
.static IgniteUuid
fromUuid(UUID id)
Constructs newIgniteUuid
based on global and local ID portions.UUID
globalId()
Gets global ID portion of thisIgniteUuid
.int
hashCode()
org.apache.ignite.internal.util.lang.GridIterator<IgniteUuid>
iterator()
static long
lastLocalId()
Gets last generated local ID.long
localId()
Gets local ID portion of thisIgniteUuid
.static IgniteUuid
randomUuid()
Creates new pseudo-random ID.void
readBinary(BinaryReader reader)
Reads fields from provided reader.void
readExternal(ObjectInput in)
String
shortString()
Gets a short string version of this ID.String
toString()
static UUID
vmId()
GetsUUID
associated with local VM.void
writeBinary(BinaryWriter writer)
Writes fields to provided writer.void
writeExternal(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)
ConstructsIgniteUuid
from a global and local identifiers.- Parameters:
gid
- UUID.locId
- Counter.
-
-
Method Detail
-
vmId
public static UUID vmId()
GetsUUID
associated with local VM.- Returns:
UUID
associated 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 newIgniteUuid
based 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:
IgniteUuid
instance 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:
writeExternal
in interfaceExternalizable
- Throws:
IOException
-
readExternal
public void readExternal(ObjectInput in) throws IOException
- Specified by:
readExternal
in interfaceExternalizable
- Throws:
IOException
-
compareTo
public int compareTo(IgniteUuid o)
- Specified by:
compareTo
in interfaceComparable<IgniteUuid>
-
iterator
public org.apache.ignite.internal.util.lang.GridIterator<IgniteUuid> iterator()
- Specified by:
iterator
in interfaceIterable<IgniteUuid>
-
writeBinary
public void writeBinary(BinaryWriter writer) throws BinaryObjectException
Writes fields to provided writer.- Specified by:
writeBinary
in 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:
readBinary
in interfaceBinarylizable
- Parameters:
reader
- Binary object reader.- Throws:
BinaryObjectException
- In case of error.
-
clone
public Object clone() throws CloneNotSupportedException
- Overrides:
clone
in classObject
- Throws:
CloneNotSupportedException
-
-