org.apache.activemq.apollo.broker
Class XidImpl

java.lang.Object
  extended by org.apache.activemq.apollo.broker.XidImpl
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, javax.transaction.xa.Xid

public class XidImpl
extends java.lang.Object
implements javax.transaction.xa.Xid, java.lang.Cloneable, java.io.Serializable

An implementation of JTA transaction identifier (javax.transaction.xa.Xid).

See Also:
Serialized Form

Field Summary
 
Fields inherited from interface javax.transaction.xa.Xid
MAXBQUALSIZE, MAXGTRIDSIZE
 
Constructor Summary
XidImpl()
          Constructs a new null XID.
XidImpl(int formatID, org.fusesource.hawtbuf.Buffer globalTransactionId, org.fusesource.hawtbuf.Buffer branchQualifier)
           
XidImpl(int formatID, byte[] globalTxnID, byte[] branchID)
           
XidImpl(java.lang.String globalTxnId, java.lang.String branchId)
           
XidImpl(javax.transaction.xa.Xid from)
          Initialize an XID using another XID as the source of data.
 
Method Summary
 boolean equals(java.lang.Object o)
          Determine whether or not two objects of this type are equal.
 byte[] getBranchQualifier()
          Returns the branch qualifier for this XID.
 int getFormatId()
          Obtain the format identifier part of the XID.
 byte[] getGlobalTransactionId()
          Returns the global transaction identifier for this XID.
 int getMemorySize()
           
 int hashCode()
          Compute the hash code.
 void readbody(java.io.DataInput in)
          read xid from an Array and set each fields.
static org.fusesource.hawtbuf.Buffer toBuffer(javax.transaction.xa.Xid xid)
           
 java.lang.String toString()
          Return a string representing this XID.
 void writebody(java.io.DataOutput out)
          Writes this XidImpl's data to the DataOutput destination
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

XidImpl

public XidImpl()
Constructs a new null XID.

After construction the data within the XID should be initialized.


XidImpl

public XidImpl(int formatID,
               byte[] globalTxnID,
               byte[] branchID)

XidImpl

public XidImpl(int formatID,
               org.fusesource.hawtbuf.Buffer globalTransactionId,
               org.fusesource.hawtbuf.Buffer branchQualifier)

XidImpl

public XidImpl(javax.transaction.xa.Xid from)
Initialize an XID using another XID as the source of data.

Parameters:
from - the XID to initialize this XID from

XidImpl

public XidImpl(java.lang.String globalTxnId,
               java.lang.String branchId)
Method Detail

equals

public boolean equals(java.lang.Object o)
Determine whether or not two objects of this type are equal.

Overrides:
equals in class java.lang.Object
Parameters:
o - the other XID object to be compared with this XID.
Returns:
Returns true of the supplied object represents the same global transaction as this, otherwise returns false.

hashCode

public int hashCode()
Compute the hash code.

Overrides:
hashCode in class java.lang.Object
Returns:
the computed hashcode

toString

public java.lang.String toString()
Return a string representing this XID.

This is normally used to display the XID when debugging.

Overrides:
toString in class java.lang.Object
Returns:
the string representation of this XID

getFormatId

public int getFormatId()
Obtain the format identifier part of the XID.

Specified by:
getFormatId in interface javax.transaction.xa.Xid
Returns:
Format identifier. -1 indicates a null XID

getGlobalTransactionId

public byte[] getGlobalTransactionId()
Returns the global transaction identifier for this XID.

Specified by:
getGlobalTransactionId in interface javax.transaction.xa.Xid
Returns:
the global transaction identifier

getBranchQualifier

public byte[] getBranchQualifier()
Returns the branch qualifier for this XID.

Specified by:
getBranchQualifier in interface javax.transaction.xa.Xid
Returns:
the branch qualifier

getMemorySize

public int getMemorySize()

writebody

public void writebody(java.io.DataOutput out)
               throws java.io.IOException
Writes this XidImpl's data to the DataOutput destination

Parameters:
out - The DataOutput destination
Throws:
java.io.IOException

readbody

public void readbody(java.io.DataInput in)
              throws java.io.IOException
read xid from an Array and set each fields.

Parameters:
in - the data input array
Throws:
java.io.IOException

toBuffer

public static org.fusesource.hawtbuf.Buffer toBuffer(javax.transaction.xa.Xid xid)
Parameters:
xid -
Returns:


Copyright © 2005-2011 The Apache Software Foundation. All Rights Reserved.