use of com.arjuna.ats.jta.xa.XidImple in project narayana by jbosstm.
the class SubordinateJTAXAResourceOrphanFilter method transactionLog.
/**
* Is there a log file for this transaction?
*
* @param recoveredResourceXid
* the transaction to check.
*
* @return <code>boolean</code>true if there is a log file,
* <code>false</code> if there isn't.
*/
private boolean transactionLog(Xid recoveredResourceXid, String recoveredResourceNodeName) {
XidImple theXid = new XidImple(recoveredResourceXid);
Uid u = theXid.getTransactionUid();
if (jtaLogger.logger.isDebugEnabled()) {
jtaLogger.logger.debug("Checking whether Xid " + theXid + " exists in ObjectStore.");
}
if (!u.equals(Uid.nullUid())) {
RecoveryStore recoveryStore = StoreManager.getRecoveryStore();
String transactionType = SubordinateAtomicAction.getType();
if (jtaLogger.logger.isDebugEnabled()) {
jtaLogger.logger.debug("Looking for " + u + " and " + transactionType);
}
InputObjectState states = new InputObjectState();
try {
if (recoveryStore.allObjUids(transactionType, states) && (states.notempty())) {
Stack values = new Stack();
boolean finished = false;
do {
Uid uid = null;
try {
uid = UidHelper.unpackFrom(states);
} catch (IOException ex) {
ex.printStackTrace();
finished = true;
}
if (uid.notEquals(Uid.nullUid())) {
SubordinateAtomicAction tx = new SubordinateAtomicAction(uid, true);
XidImple transactionXid = (XidImple) tx.getXid();
if (transactionXid != null && transactionXid.isSameTransaction(recoveredResourceXid)) {
if (jtaLogger.logger.isDebugEnabled()) {
jtaLogger.logger.debug("Found record for " + theXid);
}
return true;
}
} else
finished = true;
} while (!finished);
if (jtaLogger.logger.isDebugEnabled()) {
jtaLogger.logger.debug("No record found for " + theXid);
}
} else {
jtaLogger.i18NLogger.info_recovery_notaxid(XAHelper.xidToString(recoveredResourceXid));
}
} catch (ObjectStoreException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return false;
}
use of com.arjuna.ats.jta.xa.XidImple in project narayana by jbosstm.
the class TransactionImple method createXid.
protected Xid createXid(boolean branch, XAModifier theModifier, XAResource xaResource) throws IOException, ObjectStoreException {
int eisName = 0;
if (branch) {
if (_xaResourceRecordWrappingPlugin != null) {
eisName = _xaResourceRecordWrappingPlugin.getEISName(xaResource);
}
}
Xid xid = new XidImple(_theTransaction.get_uid(), branch, eisName);
if (theModifier != null) {
try {
xid = theModifier.createXid((XidImple) xid);
} catch (Exception e) {
e.printStackTrace();
}
}
return xid;
}
use of com.arjuna.ats.jta.xa.XidImple in project narayana by jbosstm.
the class TransactionImporterImple method convertXid.
private XidImple convertXid(Xid xid) {
if (xid != null && xid.getFormatId() == XATxConverter.FORMAT_ID) {
XidImple toImport = new XidImple(xid);
XATxConverter.setSubordinateNodeName(toImport.getXID(), TxControl.getXANodeName());
return new SubordinateXidImple(toImport);
} else {
return new XidImple(xid);
}
}
use of com.arjuna.ats.jta.xa.XidImple in project narayana by jbosstm.
the class SubordinateAtomicAction method restore_state.
public boolean restore_state(InputObjectState os, int t) {
_theXid = null;
try {
unpackHeader(os, new Header());
boolean haveXid = os.unpackBoolean();
if (haveXid) {
_theXid = new XidImple();
((XidImple) _theXid).unpackFrom(os);
_parentNodeName = os.unpackString();
}
} catch (IOException ex) {
return false;
}
return super.restore_state(os, t);
}
use of com.arjuna.ats.jta.xa.XidImple in project narayana by jbosstm.
the class SubordinateAtomicAction method save_state.
public boolean save_state(OutputObjectState os, int t) {
try {
// pack the header first for the benefit of the tooling
packHeader(os, new Header(get_uid(), Utility.getProcessUid()));
if (_theXid != null) {
os.packBoolean(true);
((XidImple) _theXid).packInto(os);
os.packString(_parentNodeName);
} else
os.packBoolean(false);
} catch (IOException ex) {
return false;
}
return super.save_state(os, t);
}
Aggregations