@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); } }
@Override public Transaction makeParallelNestedTransaction(boolean readOnly) { if (!readOnly) { throw new WriteOnReadException(); } return new ParallelNestedReadOnlyTransaction(this); }
protected void ensureCommitStatus() { ActiveTransactionsRecord recordToCommit = Transaction.mostRecentCommittedRecord.getNext(); while ((recordToCommit != null) && (recordToCommit.transactionNumber <= getCommitTxRecord().transactionNumber)) { helpCommit(recordToCommit); recordToCommit = recordToCommit.getNext(); } }
@Override protected void ensureCommitStatus() { ActiveTransactionsRecord recordToCommit = Transaction.mostRecentCommittedRecord.getNext(); while ((recordToCommit != null) && (recordToCommit.transactionNumber < getCommitTxRecord().transactionNumber)) { helpCommit(recordToCommit); recordToCommit = recordToCommit.getNext(); } }
protected ActiveTransactionsRecord helpCommitAll() { ActiveTransactionsRecord lastSeenCommitted = Transaction.mostRecentCommittedRecord; ActiveTransactionsRecord recordToCommit = lastSeenCommitted.getNext(); while (recordToCommit != null) { helpCommit(recordToCommit); lastSeenCommitted = recordToCommit; recordToCommit = recordToCommit.getNext(); } return lastSeenCommitted; }
protected void finishCommit(ActiveTransactionsRecord recordToCommit) { // we only advance the most recent committed record if we don't see this // transaction already committed if (!recordToCommit.isCommitted()) { recordToCommit.setCommitted(); Transaction.setMostRecentCommittedRecord(recordToCommit); } } }
@Override protected void tryCommit() { ActiveTransactionsRecord commitRecord = getCommitTxRecord(); // we know we're valid and we're already enqueued. just set the writeset ((InevitableActiveTransactionsRecord)commitRecord).setWriteSet(makeWriteSet()); helpCommit(commitRecord); upgradeTx(commitRecord); }
private ActiveTransactionsRecord() { this.transactionNumber = 1; this.writeSet = WriteSet.empty(); this.recordCommitted = true; this.tx = new TopLevelReadTransaction(this); } private static boolean sentinelRecordCreated = false;
@Override protected Transaction commitAndBeginTx(boolean readOnly) { context().inCommitAndBegin = true; try { commitTx(true); } finally { context().inCommitAndBegin = false; } // at this point activeTxRecord and commitTxRecord are the same... return Transaction.beginWithActiveRecord(readOnly, this.activeTxRecord); }
@Override protected Transaction commitAndBeginTx(boolean readOnly) { context().inCommitAndBegin = true; commitTx(true); context().inCommitAndBegin = false; return Transaction.beginWithActiveRecord(readOnly, this.activeTxRecord); }
@Override public Transaction makeParallelNestedTransaction(boolean readOnly) { if (readOnly) { return new ParallelNestedReadOnlyTransaction(this); } else { return new ParallelNestedTransaction(this); } }
@Override protected Transaction commitAndBeginTx(boolean readOnly) { commitTx(true); return Transaction.beginUnsafeSingleThreaded(); }
public VBox(E initial) { inplace = new InplaceWrite<E>(); put(initial); }