use of com.arjuna.ArjunaOTS.TransactionInfo in project narayana by jbosstm.
the class TransactionFactoryImple method getTransactionInfo.
/**
* @return information on a specific transaction.
* @since JTS 2.1.2.
*/
public TransactionInfo getTransactionInfo(Uid u) throws org.omg.CosTransactions.NoTransaction, SystemException {
if (!u.valid())
throw new BAD_PARAM(jtsLogger.i18NLogger.get_orbspecific_invaliduid() + " " + u);
else {
try {
synchronized (ControlImple.allControls) {
ControlImple ctx = (ControlImple) ControlImple.allControls.get(u);
if (ctx != null) {
TransactionInfo info = new TransactionInfo();
info.currentDepth = ctx.getImplHandle().getHierarchy().depth();
TransactionReaper reaper = TransactionReaper.transactionReaper();
info.timeout = reaper.getTimeout(ctx);
info.numberOfThreads = ctx.getImplHandle().activeThreads();
return info;
} else
throw new NoTransaction();
}
} catch (NoTransaction ex) {
throw ex;
} catch (Exception e) {
e.printStackTrace();
throw new UNKNOWN();
}
}
}
use of com.arjuna.ArjunaOTS.TransactionInfo in project narayana by jbosstm.
the class TransactionFactoryUnitTest method testInfo.
@Test
public void testInfo() throws Exception {
TransactionFactoryImple factory = new TransactionFactoryImple("test");
ControlImple tx = factory.createLocal(1000);
TransactionInfo info = factory.getTransactionInfo(Utility.uidToOtid(tx.get_uid()));
assertEquals(info.currentDepth, 1);
assertEquals(info.timeout, 0);
assertEquals(info.numberOfThreads, 0);
try {
tx.getImplHandle().rollback();
} catch (final Throwable ex) {
}
}
Aggregations