public static Transaction begin() { return begin(false); }
tx = Transaction.begin(isReadOnly());
@Override public void begin(boolean readOnly) { jvstm.Transaction.begin(readOnly); currentJPATx.set(new JVSTMMemTransaction()); }
@Override public void begin(boolean readOnly) throws NotSupportedException { JVSTMTransaction parent = transactions.get(); logger.debug("Begin {}Transaction. Read Only: {}", (parent != null ? "(nested)" : ""), readOnly); JvstmInFenixTransaction underlying = (JvstmInFenixTransaction) Transaction.begin(readOnly); transactions.set(new JVSTMTransaction(underlying, parent)); }
@Override public void begin(boolean readOnly) throws NotSupportedException { if (transactions.get() != null) { throw new NotSupportedException("Nesting is not yet supported in JVSTM based backends"); } logger.trace("Begin Transaction. Read Only: {}", readOnly); TopLevelTransaction underlying = (TopLevelTransaction) Transaction.begin(readOnly); transactions.set(new JvstmOJBTransaction(underlying)); }
public void put(E newE) { Transaction tx = Transaction.current(); if (tx == null) { tx = Transaction.begin(); tx.setPerTxValue(this, newE); tx.commit(); } else { tx.setPerTxValue(this, newE); } }
public E get() { Transaction tx = Transaction.current(); if (tx == null) { tx = Transaction.begin(); E result = tx.getPerTxValue(this, initial); tx.commit(); return result; } else { return tx.getPerTxValue(this, initial); } }
public static <T> T doIt(Callable<T> xaction, boolean tryReadOnly) throws Exception { T result = null; while (true) { Transaction.begin(tryReadOnly); boolean finished = false; try { result = xaction.call(); Transaction.commit(); finished = true; return result; } catch (CommitException ce) { Transaction.abort(); finished = true; } catch (WriteOnReadException wore) { Transaction.abort(); finished = true; tryReadOnly = false; } finally { if (! finished) { Transaction.abort(); } } } } }
public static void transactionallyDo(TransactionalCommand command) { while (true) { Transaction tx = Transaction.begin(); try { command.doIt(); tx.commit(); tx = null; return; } catch (CommitException ce) { tx.abort(); tx = null; } finally { if (tx != null) { tx.abort(); } } } }
Transaction.begin(readOnly); boolean txFinished = false; try {
@SuppressWarnings("static-access") public void put(int index, E newE) { rangeCheck(index); Transaction tx = Transaction.current(); if (tx == null) { tx = Transaction.begin(); tx.setArrayValue(new VArrayEntry<E>(this, index), newE); tx.commit(); } else { tx.setArrayValue(new VArrayEntry<E>(this, index), newE); } }
@SuppressWarnings("static-access") public E get(int index) { rangeCheck(index); // TODO: Apply the same optimization as in VBox.get() Transaction tx = Transaction.current(); if (tx == null) { tx = Transaction.begin(true); E value = tx.getArrayValue(new VArrayEntry<E>(this, index)); tx.commit(); return value; } else { return tx.getArrayValue(new VArrayEntry<E>(this, index)); } }