use of org.omg.CosTransactions.NoTransaction in project narayana by jbosstm.
the class Test03 method main.
public static void main(String[] args) {
try {
ORBInterface.initORB(args, null);
OAInterface.initOA();
boolean correct = true;
Current current = OTS.get_current();
try {
current.rollback();
correct = false;
} catch (NoTransaction noTransaction) {
}
if (correct) {
System.out.println("Passed");
} else {
System.out.println("Failed");
}
} catch (Exception exception) {
System.out.println("Failed");
System.err.println("Test03.main: " + exception);
exception.printStackTrace(System.err);
}
try {
OAInterface.shutdownOA();
ORBInterface.shutdownORB();
} catch (Exception exception) {
System.err.println("Test03.main: " + exception);
exception.printStackTrace(System.err);
}
}
use of org.omg.CosTransactions.NoTransaction in project narayana by jbosstm.
the class Test11 method main.
public static void main(String[] args) {
try {
ORBInterface.initORB(args, null);
OAInterface.initOA();
boolean correct = true;
Current current = OTS.get_current();
current.begin();
current.commit(false);
try {
current.rollback();
correct = false;
} catch (NoTransaction noTransaction) {
}
if (correct) {
System.out.println("Passed");
} else {
System.out.println("Failed");
}
} catch (Exception exception) {
System.out.println("Failed");
System.err.println("Test11.main: " + exception);
exception.printStackTrace(System.err);
}
try {
OAInterface.shutdownOA();
ORBInterface.shutdownORB();
} catch (Exception exception) {
System.err.println("Test11.main: " + exception);
exception.printStackTrace(System.err);
}
}
use of org.omg.CosTransactions.NoTransaction in project narayana by jbosstm.
the class Test13 method main.
public static void main(String[] args) {
try {
ORBInterface.initORB(args, null);
OAInterface.initOA();
boolean correct = true;
Current current = OTS.get_current();
current.begin();
current.rollback();
try {
current.commit(true);
correct = false;
} catch (NoTransaction noTransaction) {
}
if (correct) {
System.out.println("Passed");
} else {
System.out.println("Failed");
}
} catch (Exception exception) {
System.out.println("Failed");
System.err.println("Test13.main: " + exception);
exception.printStackTrace(System.err);
}
try {
OAInterface.shutdownOA();
ORBInterface.shutdownORB();
} catch (Exception exception) {
System.err.println("Test13.main: " + exception);
exception.printStackTrace(System.err);
}
}
use of org.omg.CosTransactions.NoTransaction in project narayana by jbosstm.
the class TransactionFactoryImple method activeTransactions.
private final org.omg.CosTransactions.otid_t[] activeTransactions() throws Inactive, NoTransaction, SystemException {
if (jtsLogger.logger.isTraceEnabled()) {
jtsLogger.logger.trace("TransactionFactoryImple::activeTransactions ()");
}
if (ControlImple.allControls == null)
throw new Inactive();
else {
synchronized (ControlImple.allControls) {
if (ControlImple.allControls.size() == 0)
throw new NoTransaction();
else {
org.omg.CosTransactions.otid_t[] ids = new org.omg.CosTransactions.otid_t[ControlImple.allControls.size()];
Enumeration iter = ControlImple.allControls.elements();
int i = 0;
while (iter.hasMoreElements()) {
ControlImple cont = (ControlImple) iter.nextElement();
if (cont != null) {
ids[i] = Utility.uidToOtid(cont.get_uid().stringForm());
i++;
}
}
return ids;
}
}
}
}
use of org.omg.CosTransactions.NoTransaction in project narayana by jbosstm.
the class AtomicTransaction method end.
/*
* public synchronized void begin () throws SubtransactionsUnavailable,
* SystemException { if (jtaxLogger.loggerI18N.isWarnEnabled()) {
* jtaxLogger.loggerI18N.warn("com.arjuna.ats.internal.jta.transaction.jts.atomictxnobegin"); }
*
* throw new INVALID_TRANSACTION(ExceptionCodes.ALREADY_BEGUN,
* CompletionStatus.COMPLETED_NO); }
*/
/**
* Does not change thread-to-tx association as base class commit does.
*/
public synchronized void end(boolean report_heuristics) throws NoTransaction, HeuristicMixed, HeuristicHazard, WrongTransaction, SystemException {
if (jtaxLogger.logger.isTraceEnabled()) {
jtaxLogger.logger.trace("AtomicTransaction::end ( " + report_heuristics + " ) for " + _theAction);
}
if (_theAction == null) {
throw new NoTransaction();
}
try {
_theAction.commit(report_heuristics);
_theStatus = Status.StatusCommitted;
} catch (Unavailable e) {
_theStatus = Status.StatusNoTransaction;
throw new NoTransaction();
} catch (HeuristicMixed e) {
_theStatus = getStatus();
throw e;
} catch (HeuristicHazard e) {
_theStatus = getStatus();
throw e;
} catch (TRANSACTION_ROLLEDBACK e) {
_theStatus = Status.StatusRolledBack;
throw e;
} catch (SystemException e) {
_theStatus = getStatus();
throw e;
} finally {
// now remove it from the reaper
TransactionReaper.transactionReaper().remove(_theAction);
}
}
Aggregations