use of com.arjuna.ats.internal.jts.ControlWrapper in project narayana by jbosstm.
the class AtomicTransaction method validTransaction.
/**
* If this transaction current? Assume we have checked that we are actually
* a transaction!
*
* If not valid then abort this transaction here. Leave current alone.
*/
protected final boolean validTransaction() {
if (jtsLogger.logger.isTraceEnabled()) {
jtsLogger.logger.trace("AtomicTransaction::validTransaction called for " + _theAction);
}
/*
* If we get here then _theAction is not null.
*/
CurrentImple current = OTSImpleManager.current();
boolean valid = false;
try {
ControlWrapper currentTransaction = current.getControlWrapper();
if (currentTransaction == null) {
jtsLogger.i18NLogger.warn_extensions_atnovalidtx("AtomicTransaction.validTransaction");
return false;
}
valid = _theAction.equals(currentTransaction);
if (!valid) {
String transactionName = get_transaction_name();
String currentTransactionName = currentTransaction.get_transaction_name();
jtsLogger.i18NLogger.warn_extensions_atoutofseq("AtomicTransaction", transactionName);
jtsLogger.i18NLogger.warn_extensions_atwillabort(currentTransactionName);
try {
_theAction.rollback();
} catch (Exception ex) {
jtsLogger.i18NLogger.warn_extensions_atcannotabort("AtomicTransaction", transactionName);
}
}
} catch (Exception e) {
jtsLogger.i18NLogger.warn_extensions_atgenerror("AtomicTransaction", e);
}
return valid;
}
use of com.arjuna.ats.internal.jts.ControlWrapper in project narayana by jbosstm.
the class AtomicTransaction method equals.
public boolean equals(Object obj) {
if (obj == null)
return false;
if (obj == this)
return true;
if (obj instanceof AtomicTransaction) {
try {
AtomicTransaction tx = (AtomicTransaction) obj;
ControlWrapper txControl = tx._theAction;
if ((_theAction == null) && (txControl == null)) {
return true;
} else if (_theAction == null) {
return false;
} else {
return _theAction.equals(txControl);
}
} catch (Exception e) {
}
}
return false;
}
use of com.arjuna.ats.internal.jts.ControlWrapper in project narayana by jbosstm.
the class JtsTransactionImple method controlToTx.
/**
* Convert an IOR representing an OTS transaction into a JTA transaction
*
* @param orb
*
* @param ior the CORBA reference for the OTS transaction
* @return a JTA transaction that wraps the OTS transaction
*/
private static Transaction controlToTx(String ior) {
log.debug("controlToTx: ior: " + ior);
ControlWrapper cw = createControlWrapper(ior);
TransactionImple tx = (TransactionImple) TransactionImple.getTransactions().get(cw.get_uid());
if (tx == null) {
log.debug("controlToTx: creating a new tx - wrapper: " + cw);
tx = new JtsTransactionImple(cw);
putTransaction(tx);
}
return tx;
}
use of com.arjuna.ats.internal.jts.ControlWrapper in project narayana by jbosstm.
the class JtsTransactionImple method createControlWrapper.
private static ControlWrapper createControlWrapper(String ior) {
org.omg.CORBA.Object obj = ORBManager.getORB().orb().string_to_object(ior);
Control control = org.omg.CosTransactions.ControlHelper.narrow(obj);
if (control == null)
log.warn("createProxy: ior not a control");
return new ControlWrapper(control);
}
Aggregations