use of com.sun.jts.CosTransactions.ControlImpl in project Payara by payara.
the class TransactionState method computeXid.
private Xid computeXid(XAResource res, Control control) throws Inactive, Unavailable, XAException {
// one branch id per RM
int size = factories.size();
for (int i = 0; i < size; i++) {
XAResource fac = (XAResource) factories.get(i);
if (res.isSameRM(fac)) {
// use same branch
Xid xid = (Xid) resourceList.get(fac);
return xid;
}
}
// use a different branch
// XXX ideally should call JTS layer to get the branch id
XID xid;
if (Configuration.isLocalFactory()) {
xid = Utility.getXID(((ControlImpl) control).get_localCoordinator());
} else {
xid = Utility.getXID(control.get_coordinator());
}
factories.add(res);
byte[] branchid = parseSize(size);
byte[] sname = Configuration.getServerNameByteArray();
byte[] branch = new byte[sname.length + 1 + branchid.length];
System.arraycopy(sname, 0, branch, 0, sname.length);
branch[sname.length] = (byte) ',';
System.arraycopy(branchid, 0, branch, sname.length + 1, branchid.length);
xid.setBranchQualifier(branch);
return xid;
}
use of com.sun.jts.CosTransactions.ControlImpl in project Payara by payara.
the class FailureInducer method getGlobalTID.
private static GlobalTID getGlobalTID() {
GlobalTID gtid = null;
Coordinator coord = Utility.getCoordinator(Utility.getControl());
JCoordinator jcoord = JCoordinatorHelper.narrow(coord);
if (jcoord != null) {
gtid = new GlobalTID(jcoord.getGlobalTID());
} else {
ControlImpl control = CurrentTransaction.getCurrent();
if (control != null) {
gtid = control.getGlobalTID();
}
}
return gtid;
}
Aggregations