org.jboss.tm
Class XidImpl

java.lang.Object
  extended byorg.jboss.tm.XidImpl
All Implemented Interfaces:
java.io.Serializable, Xid (src)

public class XidImpl
extends java.lang.Object
implements Xid (src) , java.io.Serializable

This object encapsulates the ID of a transaction. This implementation is immutable and always serializable at runtime.

See Also:
TransactionImpl (src) , Serialized Form

Field Summary
static int JBOSS_FORMAT_ID
           
 
Fields inherited from interface javax.transaction.xa.Xid (src)
MAXBQUALSIZE, MAXGTRIDSIZE
 
Constructor Summary
XidImpl(int formatId, byte[] globalId, byte[] branchId, int hash, long localId)
          Create a new instance.
XidImpl(XidImpl (src)  xidImpl, byte[] branchId)
          Create a new branch of an existing global transaction ID.
 
Method Summary
 boolean equals(java.lang.Object obj)
          Compare for equality.
 byte[] getBranchQualifier()
          Return the branch qualifier of this transaction.
 int getFormatId()
          Return the format identifier of this transaction.
 byte[] getGlobalTransactionId()
          Return the global transaction id of this transaction.
 LocalId (src) getLocalId()
          Return a LocalId instance that identifies this transaction within the JBoss server.
 long getLocalIdValue()
          Return the local id that identifies this transaction within the JBoss server.
 GlobalId (src) getTrulyGlobalId()
          Return a GlobalId instance that identifies this transaction in a distributed environment.
static boolean getTrulyGlobalIdsEnabled()
          Getter for class variable trulyGlobalIdsEnabled.
 int hashCode()
           
 boolean sameTransaction(XidImpl (src)  other)
          Compare for same transaction.
static void setTrulyGlobalIdsEnabled(boolean newValue)
          Setter for class variable trulyGlobalIdsEnabled.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

JBOSS_FORMAT_ID

public static final int JBOSS_FORMAT_ID
See Also:
Constant Field Values (src)
Constructor Detail

XidImpl

public XidImpl(int formatId,
               byte[] globalId,
               byte[] branchId,
               int hash,
               long localId)
Create a new instance.


XidImpl

public XidImpl(XidImpl (src)  xidImpl,
               byte[] branchId)
Create a new branch of an existing global transaction ID.

Parameters:
xidImpl - The transaction ID to create a new branch of.
branchId - The ID of the new branch.
Method Detail

setTrulyGlobalIdsEnabled

public static void setTrulyGlobalIdsEnabled(boolean newValue)
Setter for class variable trulyGlobalIdsEnabled.


getTrulyGlobalIdsEnabled

public static boolean getTrulyGlobalIdsEnabled()
Getter for class variable trulyGlobalIdsEnabled.


getGlobalTransactionId

public byte[] getGlobalTransactionId()
Return the global transaction id of this transaction.

Specified by:
getGlobalTransactionId in interface Xid (src)
Returns:
A byte array that together with the format ID defines the globally unique ID of this transaction.

getBranchQualifier

public byte[] getBranchQualifier()
Return the branch qualifier of this transaction.

Specified by:
getBranchQualifier in interface Xid (src)
Returns:
A byte array that identifies the branch of this transaction.

getFormatId

public int getFormatId()
Return the format identifier of this transaction. The format identifier augments the global id and specifies how the global id and branch qualifier should be interpreted.

Specified by:
getFormatId in interface Xid (src)
Returns:
An integer denoting the family of this transaction, and telling how the two other parts can be interpreted.

equals

public boolean equals(java.lang.Object obj)
Compare for equality. Instances are considered equal if they are both instances of XidImpl, and if they have the same format id, the same global transaction id and the same transaction branch qualifier.


hashCode

public int hashCode()

toString

public java.lang.String toString()

getLocalIdValue

public long getLocalIdValue()
Return the local id that identifies this transaction within the JBoss server.


getLocalId

public LocalId (src)  getLocalId()
Return a LocalId instance that identifies this transaction within the JBoss server.


getTrulyGlobalId

public GlobalId (src)  getTrulyGlobalId()
Return a GlobalId instance that identifies this transaction in a distributed environment.


sameTransaction

public boolean sameTransaction(XidImpl (src)  other)
Compare for same transaction. Instances represent the same transaction if they have the same format id and global transaction id.