5556575859606162636465
try { cache.put(3, 5); cache.put(10, 14); transaction1.commit(); } catch (TransactionException exception) { transaction1.rollback(); } finally { transaction1.close(); } System.out.println("Value for the key 3 is " + cache.get(3)); System.out.println("Value for the key 10 is " + cache.get(10));
6869707172737475767778
try { cache.put(1, 10); cache.put(10, 13); transaction2.commit(); } catch (TransactionException exception) { transaction2.rollback(); } finally { transaction2.close(); } System.out.println("Value for the key 1 is " + cache.get(1)); System.out.println("Value for the key 10 is " + cache.get(10));
try { cache.put(3, 5); cache.put(10, 14); transaction1.commit(); } catch(TransactionException exception) { transaction1.rollback(); } finally{ transaction1.close(); } System.out.println("Value for the key 3 is "+cache.get(3)); System.out.println("Value for the key 10 is "+cache.get(10));
try { cache.put(1, 10); cache.put(10, 13); transaction2.commit(); } catch(TransactionException exception) { transaction2.rollback(); } finally{ transaction2.close(); } System.out.println("Value for the key 1 is "+cache.get(1)); System.out.println("Value for the key 10 is "+cache.get(10));