Methods Summary |
---|
public static void | forget(java.lang.String coordId)Cleanup.
final Xid removed = remove(coordId);
if (removed != null) {
remove(removed);
}
|
public static javax.transaction.xa.Xid | get(java.lang.String coordId)
return coordId2Xid.get(coordId);
|
public byte[] | getBranchQualifier()
return BRANCH_QUALIFIER;
|
public java.lang.String | getCoordinationId()
return coordId;
|
public int | getFormatId() //cache
return FORMAT_ID;
|
public byte[] | getGlobalTransactionId()
return gtrId.clone();
|
public static javax.transaction.xa.Xid | lookupOrCreate(java.lang.String coordId)
Xid result = get(coordId);
if (result == null) {
result = new CoordinationXid(coordId);
coordId2Xid.put(coordId, result);
xid2CoordId.put(result, coordId);
}
return result;
|
private static javax.transaction.xa.Xid | remove(java.lang.String coordId)
return coordId2Xid.remove(coordId);
|
private static java.lang.String | remove(javax.transaction.xa.Xid coordId)
return xid2CoordId.remove(coordId);
|
public java.lang.String | toString()
// return cache if it exists
if (stringForm != null){
return stringForm;
}
// Otherwise format the global identifier.
//char[] buff = new char[gtrId.length*2 + 2/*'[' and ']'*/ + 3/*bqual and ':'*/];
char[] buff = new char[gtrId.length * 2 + 3/*bqual and ':'*/];
int pos = 0;
//buff[pos++] = '[';
// Convert the global transaction identifier into a string of hex digits.
final int globalLen = gtrId.length;
for (int i = 0; i < globalLen; i++) {
final int currCharHigh = (gtrId[i] & 0xf0) >> 4;
final int currCharLow = gtrId[i] & 0x0f;
buff[pos++] = (char) (currCharHigh + (currCharHigh > 9 ? 'A" - 10 : '0"));
buff[pos++] = (char) (currCharLow + (currCharLow > 9 ? 'A" - 10 : '0"));
}
//buff[pos++] = ':';
buff[pos++] = '_";
final int currCharHigh = (0 & 0xf0) >> 4;
final int currCharLow = 0 & 0x0f;
buff[pos++] = (char) (currCharHigh + (currCharHigh > 9 ? 'A" - 10 : '0"));
buff[pos++] = (char) (currCharLow + (currCharLow > 9 ? 'A" - 10 : '0"));
//buff[pos] = ']';
// Cache the string form of the global identifier.
stringForm = new String(buff);
return stringForm;
|