Thread.currentThread().setName("testOrderedCommitResources");
poolingDataSource1.setTwoPcOrderingPosition(200);
poolingDataSource2.setTwoPcOrderingPosition(-1);
if (log.isDebugEnabled()) { log.debug("*** getting TM"); }
BitronixTransactionManager tm = TransactionManagerServices.getTransactionManager();
if (log.isDebugEnabled()) { log.debug("*** before begin"); }
tm.setTransactionTimeout(10);
tm.begin();
if (log.isDebugEnabled()) { log.debug("*** after begin"); }
if (log.isDebugEnabled()) { log.debug("*** getting connection from DS1"); }
Connection connection1 = poolingDataSource1.getConnection();
if (log.isDebugEnabled()) { log.debug("*** creating statement 1 on connection 1"); }
connection1.createStatement();
if (log.isDebugEnabled()) { log.debug("*** creating statement 2 on connection 1"); }
connection1.createStatement();
if (log.isDebugEnabled()) { log.debug("*** getting connection from DS2"); }
Connection connection2 = poolingDataSource2.getConnection();
if (log.isDebugEnabled()) { log.debug("*** creating statement 1 on connection 2"); }
connection2.createStatement();
if (log.isDebugEnabled()) { log.debug("*** creating statement 2 on connection 2"); }
connection2.createStatement();
if (log.isDebugEnabled()) { log.debug("*** closing connection 1"); }
connection1.close();
if (log.isDebugEnabled()) { log.debug("*** closing connection 2"); }
connection2.close();
if (log.isDebugEnabled()) { log.debug("*** committing"); }
tm.commit();
if (log.isDebugEnabled()) { log.debug("*** TX is done"); }
// check flow
List orderedEvents = EventRecorder.getOrderedEvents();
log.info(EventRecorder.dumpToString());