Example #1
3
  @Test
  public void testInc() {
    LongRef ref = new LongRef(100);

    assertEquals(101, ref.inc());
    assertEquals(101, ref.get());

    assertEquals(111, ref.inc(10));
    assertEquals(111, ref.get());

    assertEquals(100, ref.inc(-11));
    assertEquals(100, ref.get());
  }
Example #2
1
  @TransactionalMethod
  public void incButAbort(LongRef... refs) {
    for (LongRef ref : refs) {
      ref.inc();
    }

    getThreadLocalTransaction().abort();
  }