Package bitronix.tm.utils
Class UidGenerator
java.lang.Object
bitronix.tm.utils.UidGenerator
Helper that offers UID generation (GTRID, XID, sequences) needed by the transaction manager.
Generated UIDs are at most 64 bytes long and are made of 3 subparts: the current time in milliseconds since
Epoch, a JVM transient atomic sequence number and the configured bitronix.tm.serverId.
The reliance on the system clock is critical to the uniqueness of the UID in the network so you have to make sure all servers of the network running this transaction manager have their clock reasonably in sync. An order of 1 second synchronicity is generally fine.
- Author:
- lorban
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic UidGenerate a UID, globally unique.static BitronixXidgenerateXid(Uid gtrid) Generate a XID with the specified globalTransactionId.
-
Constructor Details
-
UidGenerator
public UidGenerator()
-
-
Method Details
-
generateUid
Generate a UID, globally unique. This method relies on the configured serverId for network uniqueness.- Returns:
- the generated UID.
-
generateXid
Generate a XID with the specified globalTransactionId.- Parameters:
gtrid- the GTRID to use to generate the Xid.- Returns:
- the generated Xid.
-