Txn { public static <T extends Transactional, X> X calculateRead(T txn, Supplier<X> r) { return calc(txn, TxnType.READ, r); }  static void execute(T txn, Runnable r); static X calculate(T txn, Supplier<X> r); static void exec(T txn, TxnType txnType, Runnable r); static X calc(T txn, TxnType txnType, Supplier<X> r); static void executeRead(T txn, Runnable r); static X calculateRead(T txn, Supplier<X> r); static void executeWrite(T txn, Runnable r); static X calculateWrite(T txn, Supplier<X> r);  }
@Test public void txn_basic_02() { long x = Txn.calculateRead(counter, () -> { assertEquals("In R, value()", 0, counter.value()) ; assertEquals("In R, get()", 0, counter.get()) ; return counter.get() ; }) ; assertEquals("Outside R", 0, x) ; }