Class XID

  • All Implemented Interfaces:
    Xid

    public class XID
    extends Object
    implements Xid
    The XID class provides an implementation of the X/Open transaction identifier it implements the javax.transaction.xa.Xid interface.
    • Field Detail

      • MAXGTRIDSIZE

        public static final int MAXGTRIDSIZE
        The maximum size of the global transaction identifier.
        See Also:
        Constant Field Values
      • MAXBQUALSIZE

        public static final int MAXBQUALSIZE
        The maximum size of the branch qualifier.
        See Also:
        Constant Field Values
    • Constructor Detail

      • XID

        public XID()
        Constructs a new null XID.

        After construction the data within the XID should be initialized.

    • Method Detail

      • copy

        public void copy​(XID from)
        Initialize an XID using another XID as the source of data.
        Parameters:
        from - the XID to initialize this XID from
      • copy

        public void copy​(org.omg.CosTransactions.otid_t from)
        Initialize an XID using an omg otid_t as the source of data.
        Parameters:
        from - the OMG otid_t to initialize this XID from
        See Also:
        otid_t
      • equals

        public boolean equals​(Object o)
        Determine whether or not two objects of this type are equal.
        Overrides:
        equals in class Object
        Parameters:
        o - the 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 Object
        Returns:
        the computed hashcode
      • toString

        public String toString()
        Return a string representing this XID.
        Overrides:
        toString in class Object
        Returns:
        the string representation of this XID
      • getBranchQualifier

        public byte[] getBranchQualifier()
        Returns the branch qualifier for this XID.
        Specified by:
        getBranchQualifier in interface Xid
        Returns:
        the branch qualifier
      • setBranchQualifier

        public void setBranchQualifier​(byte[] qual)
        Set the branch qualifier for this XID.
        Parameters:
        qual - a Byte array containing the branch qualifier to be set. If the size of the array exceeds MAXBQUALSIZE, only the first MAXBQUALSIZE elements of qual will be used.
      • getFormatID

        public int getFormatID()
        Obtain the format identifier part of the XID.
        Returns:
        Format identifier. -1 indicates a null XID
      • setFormatID

        public void setFormatID​(int formatID)
        Set the format identifier part of the XID.
        Parameters:
        Format - identifier. -1 indicates a null Xid.
      • isEqualBranchQualifier

        public boolean isEqualBranchQualifier​(byte[] data)
        Compares the input parameter with the branch qualifier for equality.
        Returns:
        true if equal
      • isEqualGtrid

        public boolean isEqualGtrid​(XID xid)
        Return whether the Gtrid of this is equal to the Gtrid of xid
      • getGlobalTransactionIdentifier

        public byte[] getGlobalTransactionIdentifier()
        Returns the global transaction identifier for this XID.
        Returns:
        the global transaction identifier
      • getFormatId

        public int getFormatId()
        Specified by:
        getFormatId in interface Xid