Class MariaDbXid
java.lang.Object
org.mariadb.jdbc.MariaDbXid
- All Implemented Interfaces:
Xid
-
Field Summary
Fields inherited from interface Xid
MAXBQUALSIZE, MAXGTRIDSIZE -
Constructor Summary
ConstructorsConstructorDescriptionMariaDbXid(int formatId, byte[] globalTransactionId, byte[] branchQualifier) Global transaction identifier. -
Method Summary
Modifier and TypeMethodDescriptionbooleanEqual implementation.static MariaDbXidfromRecoverRow(int formatId, int gtridLength, int bqualLength, byte[] data) Build an XID from an XA RECOVER row.byte[]Get branch qualifier from XIDintGet format id from XIDbyte[]Get global transaction id from XIDinthashCode()
-
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 singledatacolumn, split according to thegtrid_lengthandbqual_lengthcolumns. 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 XIDgtridLength- server-declared global transaction identifier lengthbqualLength- server-declared branch qualifier lengthdata- concatenated gtrid + bqual bytes- Returns:
- the parsed XID
- Throws:
XAException- with XAER_RMFAIL when the lengths are negative, exceedXid.MAXGTRIDSIZE/Xid.MAXBQUALSIZE, or do not fit the payload
-
equals
-
hashCode
-
getFormatId
public int getFormatId()Get format id from XID- Specified by:
getFormatIdin interfaceXid- Returns:
- format id
-
getGlobalTransactionId
public byte[] getGlobalTransactionId()Get global transaction id from XID- Specified by:
getGlobalTransactionIdin interfaceXid- Returns:
- global transaction id
-
getBranchQualifier
public byte[] getBranchQualifier()Get branch qualifier from XID- Specified by:
getBranchQualifierin interfaceXid- Returns:
- branch qualifier
-