final int[] count = new int[1];
new Thread() {
@Override
public void run() {
JtxTransaction tx = manager.requestTransaction(new JtxTransactionMode().propagationRequired().transactionTimeout(1));
count[0]++;
assertEquals(count[0], manager.totalTransactions());
assertEquals(1, manager.totalTransactions());
assertEquals(1, manager.totalThreadTransactions());
ThreadUtil.sleep(1000);
tx.commit();
count[0]--;
}
}.start();
ThreadUtil.sleep(500);
new Thread() {
@Override
public void run() {
JtxTransaction tx = manager.requestTransaction(new JtxTransactionMode().propagationRequired().transactionTimeout(1));
count[0]++;
assertEquals(count[0], manager.totalTransactions());
assertEquals(2, manager.totalTransactions());
assertEquals(1, manager.totalThreadTransactions());
ThreadUtil.sleep(1000);