@Override
 @TransactionalMethod
 public void doRun() throws Exception {
   tx = getThreadLocalTransaction();
   ref.inc();
   barrier.joinCommit(tx);
 }
  @Test
  public void whenPendingTransactions() {
    VetoCommitBarrier barrier = new VetoCommitBarrier();

    IntRef ref1 = new IntRef();
    IntRef ref2 = new IntRef();
    IntRef ref3 = new IntRef();

    IncThread thread1 = new IncThread(ref1, barrier);
    IncThread thread2 = new IncThread(ref2, barrier);
    IncThread thread3 = new IncThread(ref3, barrier);

    startAll(thread1, thread2, thread3);

    sleepMs(500);
    barrier.vetoCommit();
    joinAll(thread1, thread2, thread3);

    assertIsCommitted(thread1.tx);
    assertIsCommitted(thread2.tx);
    assertIsCommitted(thread3.tx);

    assertEquals(1, ref1.get());
    assertEquals(1, ref2.get());
    assertEquals(1, ref3.get());
  }