{
txnLogger.entering("OutriggerServerImpl", "enterTxn");
if (baseTr == null)
return null;
ServerTransaction tr = serverTransaction(baseTr);
if (tr.isNested()) {
final String msg = "subtransactions not supported";
final CannotNestException cne = new CannotNestException(msg);
txnLogger.log(Levels.FAILED, msg, cne);
throw cne;
}
Txn txn = null;
try {
txn = txnTable.get(tr.mgr, tr.id);
} catch (IOException e) {
} catch (ClassNotFoundException e) {
} catch (SecurityException e) {
/* ignore all of these exceptions. These all indicate
* that there is at least one broken Txn with the same
* id as baseTr. Either these Txns are not associated
* with baseTr, in which case joining baseTr is fine, or
* one of them is associated with baseTr, in which case
* baseTr must be not be active (because only inactive
* Txn objects can be broken) and the join bellow will fail
*/
}
/*
* If we find the txn with the probe, we're all done. Just return.
* Otherwise, we need to join the transaction. Of course, there
* is a race condition here. While we are attempting to join,
* others might be attempting to join also. We are careful
* to ensure that only one of the racing threads is able to
* update our internal data structures with our internal
* representation of this transaction.
* NB: There are better ways of doing this which could ensure
* we never make an unnecessary remote call that we may
* want to explore later.
*/
if (txn == null) {
final TransactionManager mgr =
(TransactionManager)
transactionManagerPreparer.prepareProxy(tr.mgr);
tr = new ServerTransaction(mgr, tr.id);
tr.join(participantProxy, crashCount);
txn = txnTable.put(tr);
}
return txn;
}