public XATransactionId(final String key) { final String[] tmps = PatternUtils.split(pattern, key); if (tmps.length != 4) { throw new IllegalArgumentException("Illegal transaction key" + key); } assert tmps[0].equals("XID"); this.formatId = Integer.parseInt(tmps[1]); this.globalTransactionId = HexSupport.toBytesFromHex(tmps[2]); this.branchQualifier = HexSupport.toBytesFromHex(tmps[3]); }
@Override public synchronized String getTransactionKey() { if (this.transactionKey == null) { this.transactionKey = "XID:" + this.formatId + ":" + HexSupport.toHexFromBytes(this.globalTransactionId) + ":" + HexSupport.toHexFromBytes(this.branchQualifier); } return this.transactionKey; }