@After public void tearDown() { System.out.println("Stm.GlobalConflictCount: " + stm.getGlobalConflictCounter().count()); for (GammaTxnLong ref : refs) { System.out.println(ref.toDebugString()); } }
@Test public void whenReadonlyTransaction_thenReadonlyException() { long initialValue = 10; GammaTxnLong ref = new GammaTxnLong(stm, initialValue); long initialVersion = ref.getVersion(); GammaTxn tx = stm.newTxnFactoryBuilder() .setReadonly(true) .setSpeculative(false) .newTransactionFactory() .newTxn(); setThreadLocalTxn(tx); try { ref.increment(5); fail(); } catch (ReadonlyException expected) { } assertIsAborted(tx); assertVersionAndValue(ref, initialVersion, initialValue); }