Class MariaDbXid

java.lang.Object
org.mariadb.jdbc.MariaDbXid
All Implemented Interfaces:
Xid

public class MariaDbXid extends Object implements Xid
MariaDB XID implementation
  • Constructor Details

    • MariaDbXid

      public MariaDbXid(int formatId, byte[] globalTransactionId, byte[] branchQualifier)
      Global transaction identifier.
      Parameters:
      formatId - the format identifier part of the XID.
      globalTransactionId - the global transaction identifier part of XID as an array of bytes.
      branchQualifier - the transaction branch identifier part of XID as an array of bytes.
  • Method Details

    • fromRecoverRow

      public static MariaDbXid fromRecoverRow(int formatId, int gtridLength, int bqualLength, byte[] data) throws XAException
      Build an XID from an XA RECOVER row. The row carries the gtrid and bqual concatenated in a single data column, split according to the gtrid_length and bqual_length columns. Those lengths come from the server, so they are validated against the XA specification bounds and the actual payload before any allocation or copy: a rogue or man-in-the-middle server must not be able to drive the client into a huge allocation or an undeclared runtime exception.
      Parameters:
      formatId - the format identifier part of the XID
      gtridLength - server-declared global transaction identifier length
      bqualLength - server-declared branch qualifier length
      data - concatenated gtrid + bqual bytes
      Returns:
      the parsed XID
      Throws:
      XAException - with XAER_RMFAIL when the lengths are negative, exceed Xid.MAXGTRIDSIZE/Xid.MAXBQUALSIZE, or do not fit the payload
    • equals

      public boolean equals(Object obj)
      Equal implementation.
      Overrides:
      equals in class Object
      Parameters:
      obj - object to compare
      Returns:
      true if object is MariaDbXi and as same parameters
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • getFormatId

      public int getFormatId()
      Get format id from XID
      Specified by:
      getFormatId in interface Xid
      Returns:
      format id
    • getGlobalTransactionId

      public byte[] getGlobalTransactionId()
      Get global transaction id from XID
      Specified by:
      getGlobalTransactionId in interface Xid
      Returns:
      global transaction id
    • getBranchQualifier

      public byte[] getBranchQualifier()
      Get branch qualifier from XID
      Specified by:
      getBranchQualifier in interface Xid
      Returns:
      branch qualifier