Package com.arjuna.ats.arjuna.common
Class Uid
java.lang.Object
com.arjuna.ats.arjuna.common.Uid
- All Implemented Interfaces:
Serializable
,Cloneable
Implements a unique identity class. Since 4.9 each instance is immutable.
- Since:
- 1.0.
- Version:
- $Id: Uid.java 2342 2006-03-30 13:06:17Z $
- Author:
- Mark Little (mark@arjuna.com)
- See Also:
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionclone()
Create a copy of this instance.boolean
boolean
Override Object.equalsbyte[]
getBytes()
Get the byte representation of the Uid.boolean
greaterThan
(Uid u) int
hashCode()
Override Object.hashCode.static final Uid
Return a last resource Uid (0:0:0:0:1)boolean
static final Uid
maxUid()
Return the maximum Uid (7fffffffffffffff:7fffffffffffffff:7fffffff:7fffffff:7fffffff)static final Uid
minUid()
Return the minimum Uid (-8000000000000000:-8000000000000000:-80000000:-80000000:-80000000)boolean
static final Uid
nullUid()
Return a null Uid (0:0:0:0:0)void
print
(PrintStream strm) Print a human-readable form of the Uid.toString()
Same as stringForm()final boolean
valid()
Is the Uid valid?
-
Field Details
-
hostAddr
protected volatile long[] hostAddr -
process
protected volatile int process -
sec
protected volatile int sec -
other
protected volatile int other -
UID_SIZE
public static final int UID_SIZE- See Also:
-
-
Constructor Details
-
Uid
public Uid()Create a new instance. -
Uid
Create a copy of the specified identifier. -
Uid
public Uid(byte[] byteForm) -
Uid
Create Uid from string representation. If the string does not represent a valid Uid then the instance will be set to nullUid. -
Uid
Create Uid from string representation. boolean arg says whether to give up if an error is detected or to simply replace with nullUid. -
Uid
public Uid(long[] addr, int processId, int time, int incr)
-
-
Method Details
-
hashCode
public int hashCode()Override Object.hashCode. We always return a positive value. -
print
Print a human-readable form of the Uid. -
stringForm
-
fileStringForm
- Returns:
- a string representation of the Uid with all : replaced by _ so that the name may be used as a file name.
-
getBytes
public byte[] getBytes()Get the byte representation of the Uid. Useful for packing and creating other representations of transaction ids.- Returns:
- the byte array. Cached once created.
-
toString
Same as stringForm() -
getHexPid
-
clone
Create a copy of this instance.- Overrides:
clone
in classObject
- Throws:
CloneNotSupportedException
-
equals
Override Object.equals -
equals
-
notEquals
-
lessThan
-
greaterThan
-
valid
public final boolean valid()Is the Uid valid? -
nullUid
Return a null Uid (0:0:0:0:0) -
lastResourceUid
Return a last resource Uid (0:0:0:0:1) -
maxUid
Return the maximum Uid (7fffffffffffffff:7fffffffffffffff:7fffffff:7fffffff:7fffffff) -
minUid
Return the minimum Uid (-8000000000000000:-8000000000000000:-80000000:-80000000:-80000000)
-