@Test public void testCommit() throws Exception { TransactionId transactionId = transactionServer.start("das-test", "MySqlSimple", Hints.hints()); Assert.assertEquals(1, transactionServer.getCurrentCount()); String r = transactionServer.doInTransaction(transactionId.getUniqueId(),()->"OK"); Assert.assertEquals("OK", r); transactionServer.commit(transactionId.getUniqueId()); Assert.assertNotNull(transactionId); }
public void commit(String transactionId) throws SQLException { DalTransaction transaction = transactionMap.get(transactionId); if(transaction == null) { throw new SQLException("calling endTransaction with empty ConnectionCache"); } try { transaction.endTransaction(0); }finally{ transactionMap.remove(transactionId); } }
TransactionServer implements DataSourceConfigureConstants { public void commit(String transactionId) throws SQLException { DalTransaction transaction = transactionMap.get(transactionId); if(transaction == null) { throw new SQLException("calling endTransaction with empty ConnectionCache"); } try { transaction.endTransaction(0); }finally{ transactionMap.remove(transactionId); } } }
TransactionServer implements DataSourceConfigureConstants { public void commit(String transactionId) throws SQLException { DalTransaction transaction = transactionMap.get(transactionId); if(transaction == null) { throw new SQLException("calling endTransaction with empty ConnectionCache"); } try { transaction.endTransaction(0); }finally{ transactionMap.remove(transactionId); } } TransactionServer(String hostAddress, String workId); }
TransactionServer implements DataSourceConfigureConstants { public void commit(String transactionId) throws SQLException { DalTransaction transaction = transactionMap.get(transactionId); if(transaction == null) { throw new SQLException("calling endTransaction with empty ConnectionCache"); } try { transaction.endTransaction(0); }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); }
TransactionServer implements DataSourceConfigureConstants { public void commit(String transactionId) throws SQLException { DalTransaction transaction = transactionMap.get(transactionId); if(transaction == null) { throw new SQLException("calling endTransaction with empty ConnectionCache"); } try { transaction.endTransaction(0); }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; }