public static Transaction beginUnsafeMultithreaded() { Transaction parent = current.get(); Transaction tx = parent.makeUnsafeMultithreaded(); tx.start(); return tx; }
public static Transaction beginParallelNested(boolean readOnly) { Transaction parent = current.get(); Transaction tx = parent.makeParallelNestedTransaction(readOnly); tx.start(); return tx; }
@Override public void start() { // once we get here, we may already increment the transaction // number int newTxNumber = this.activeTxRecord.transactionNumber + 1; // renumber the TX to the new number setNumber(newTxNumber); super.start(); }
/** Warning: this method has limited usability. See the UnsafeSingleThreaded class for * details */ public static Transaction beginUnsafeSingleThreaded() { Transaction parent = current.get(); if (parent != null) { throw new Error("Unsafe single-threaded transactions cannot be nested"); } ActiveTransactionsRecord activeRecord = getRecordForNewTransaction(); Transaction tx = new UnsafeSingleThreadedTransaction(activeRecord); tx.start(); return tx; }
public static Transaction beginInevitable() { Transaction parent = current.get(); if (parent != null) { throw new Error("Inevitable transactions cannot be nested"); } ActiveTransactionsRecord activeRecord = getRecordForNewTransaction(); Transaction tx = new InevitableTransaction(activeRecord); tx.start(); return tx; }
protected static Transaction beginWithActiveRecord(boolean readOnly, ActiveTransactionsRecord activeRecord) { Transaction parent = current.get(); Transaction tx = null; if (parent == null) { if (readOnly) { tx = TRANSACTION_FACTORY.makeReadOnlyTopLevelTransaction(activeRecord); } else { tx = TRANSACTION_FACTORY.makeTopLevelTransaction(activeRecord); } } else { // passing the readOnly parameter to makeNestedTransaction is a temporary solution to // support the correct semantics in the composition of @Atomic annotations. Ideally, we // should adjust the code generation of @Atomic to let WriteOnReadExceptions pass to the // parent tx = parent.makeNestedTransaction(readOnly); } tx.start(); return tx; }
protected void synchronizeJvstmState(int serverId) { ActiveTransactionsRecord activeRecord = Transaction.getRecordForNewTransaction(); Transaction tx = new InitTransaction(activeRecord); tx.start(); VBox<Integer> initBox = StandaloneVBox.makeNew("SERVER" + serverId, false); initBox.put(serverId); tx.commitTx(true); logger.info("Set the last committed TX number to {}", Transaction.mostRecentCommittedRecord.transactionNumber); }
@Override public T call() throws Exception { super.parent.start(); Transaction tx = Transaction.beginUnsafeMultithreaded(); try { T value = execute(); tx.commit(); tx = null; return value; } catch (EarlyAbortException eae) { tx.abort(); throw eae; } catch (CommitException ce) { tx.abort(); throw ce; } catch (Throwable t) { if (t instanceof Exception) { throw (Exception) t; } else { t.printStackTrace(); System.exit(0); return null; } } }
public static Transaction begin(boolean readOnly) { ActiveTransactionsRecord activeRecord = null; Transaction parent = current(); if (TRANSACTION_FACTORY.reuseTopLevelReadOnlyTransactions() && parent == null && readOnly) { Transaction tx = getRecordForNewTransaction().tx; tx.start(); return tx; } if (parent == null) { activeRecord = getRecordForNewTransaction(); } return beginWithActiveRecord(readOnly, activeRecord); }
super.parent.start();