TransactionServer implements DataSourceConfigureConstants { public void rollback(String transactionId) throws SQLException { DalTransaction transaction = transactionMap.get(transactionId); if(transaction == null) { return; } try { transaction.rollbackTransaction(); }finally{ transactionMap.remove(transactionId); } } TransactionServer(String hostAddress, String workId); int getCurrentCount(); TransactionId start(String appId, String logicDb, Hints hints); void commit(String transactionId); void rollback(String transactionId); T doInTransaction(String transactionId, Callable<T> transaction); static final long CLEAN_UP_INTERVAL; static final double REMOVE_SCALE; }
@Test public void testRollback() throws SQLException { TransactionId transactionId = transactionServer.start("das-test", "MySqlSimple", Hints.hints()); Assert.assertEquals(1, transactionServer.getCurrentCount()); transactionServer.rollback(transactionId.getUniqueId()); Assert.assertNotNull(transactionId); }