238239240241242243244245246247248
} catch (Exception e) { Log.error("TradeDirect:buy error - rolling back", e); if ( getInGlobalTxn() ) txn.rollback(); else rollBack(conn, e); } finally {
292293294295296297298299300301302
if ( (accountData==null) || (holdingData==null) || (quoteData==null) ) { String error = "TradeDirect:sell -- error selling stock -- unable to find: \n\taccount=" +accountData + "\n\tholding=" + holdingData + "\n\tquote="+quoteData + "\nfor user: " + userID + " and holdingID: " + holdingID; Log.error(error); if ( getInGlobalTxn() ) txn.rollback(); else rollBack(conn, new Exception(error)); return orderData; }
339340341342343344345346347348349
} catch (Exception e) { Log.error("TradeDirect:sell error", e); if ( getInGlobalTxn() ) txn.rollback(); else rollBack(conn, e); } finally {
256257258259260261262263264265266
// insert and rollback ut = (UserTransaction) new InitialContext().lookup( "java:comp/UserTransaction" ); ut.begin(); ksession.insert( 3 ); ut.rollback(); // check we rolled back the state changes from the 3rd insert ut = (UserTransaction) new InitialContext().lookup( "java:comp/UserTransaction" ); ut.begin(); ksession.fireAllRules();
278279280281282283284285286287288
// rollback again, this is testing that we can do consecutive rollbacks and commits without issue ut = (UserTransaction) new InitialContext().lookup( "java:comp/UserTransaction" ); ut.begin(); ksession.insert( 5 ); ksession.insert( 6 ); ut.rollback(); ksession.fireAllRules(); assertEquals( 4, list.size() );
135136137138139140141142143144145
ut.begin(); ts.enlistResource(xares); xares.setFlag(5); assertEquals(5, xares.getFlag()); ts.delistResource(xares); ut.rollback(); assertEquals(0, xares.getFlag()); assertEquals(0, xares.getOldFlag()); }
152153154155156157158159160161162
if( e instanceof BitronixRollbackException || e.getCause() instanceof TransientObjectException ) { rollBackExceptionthrown = true; // Depends on JTA version (and thus BTM version) if( tx.getStatus() == 1 ) { tx.rollback(); } } } assertTrue( "A rollback exception should have been thrown because of foreign key violations.", rollBackExceptionthrown );
260261262263264265266267268269270
7071727374757677787980
{ if(tx!=null) { try { tx.rollback(); } catch (SystemException e1) {} } throw new RuntimeException("Unexpected invocation exception: " + e.getMessage(), e);