@Override public IHANotifyReleaseTimeResponse notifyEarliestCommitTime( final IHANotifyReleaseTimeRequest req) throws IOException, InterruptedException, BrokenBarrierException { /* * Note: Pass through [req] without checks. We need to get this * message to the CyclicBarrier regardless of whether it is * well-formed or valid. */ return ((HATXSGlue) AbstractJournal.this .getLocalTransactionManager().getTransactionService()) .notifyEarliestCommitTime(req); }
@Override public void abort(final long tx) throws IOException { setupLoggingContext(); try { final Tx localState = (Tx) getLocalTransactionManager().getTx(tx); if (localState == null) throw new IllegalArgumentException(); localState.lock.lock(); try { localState.setRunState(RunState.Aborted); } finally { localState.lock.unlock(); } } finally { clearLoggingContext(); } }
@Override public Void doTask() throws Exception { /* * Note: In this case the [revisionTime] will be LT the * [commitTime]. That's Ok as long as the issued revision times are * strictly increasing, which they are. */ final long revisionTime = localTransactionManager.nextTimestamp(); /* * Lock out other operations on this tx. */ state.lock.lockInterruptibly(); try { // Note: throws ValidationError. state.prepare(revisionTime); } finally { state.lock.unlock(); } return null; }
@Override public long commit() { // The timestamp to be assigned to this commit point. final long commitTime = nextCommitTimestamp(); // do the commit. final IRootBlockView lastRootBlock = _rootBlock; final long commitTime2; try { commitTime2 = commitNow(commitTime); } catch (Throwable t) { throw new RuntimeException(t.getLocalizedMessage() + ": lastRootBlock=" + lastRootBlock, t); } if (commitTime2 == 0L) { // Nothing to commit. return 0L; } // commitNow() should return either 0L or the commitTime we gave it. assert commitTime2 == commitTime; /* * Now that we have committed the data we notify the federation that it * should advance its global lastCommitTime. * * @todo we could use IBufferStrategy#rollback() if the notice failed, * e.g., due to a service outage. */ getLocalTransactionManager().notifyCommit(commitTime); return commitTime; }
@Override public long commit() { // The timestamp to be assigned to this commit point. final long commitTime = nextCommitTimestamp(); // do the commit. final IRootBlockView lastRootBlock = _rootBlock; final long commitTime2; try { commitTime2 = commitNow(commitTime); } catch (Throwable t) { throw new RuntimeException(t.getLocalizedMessage() + ": lastRootBlock=" + lastRootBlock, t); } if (commitTime2 == 0L) { // Nothing to commit. return 0L; } // commitNow() should return either 0L or the commitTime we gave it. assert commitTime2 == commitTime; /* * Now that we have committed the data we notify the federation that it * should advance its global lastCommitTime. * * @todo we could use IBufferStrategy#rollback() if the notice failed, * e.g., due to a service outage. */ getLocalTransactionManager().notifyCommit(commitTime); return commitTime; }
@Override public IHANotifyReleaseTimeResponse notifyEarliestCommitTime( final IHANotifyReleaseTimeRequest req) throws IOException, InterruptedException, BrokenBarrierException { /* * Note: Pass through [req] without checks. We need to get this * message to the CyclicBarrier regardless of whether it is * well-formed or valid. */ return ((HATXSGlue) AbstractJournal.this .getLocalTransactionManager().getTransactionService()) .notifyEarliestCommitTime(req); }
@Override public void abort(final long tx) throws IOException { setupLoggingContext(); try { final Tx localState = (Tx) getLocalTransactionManager().getTx(tx); if (localState == null) throw new IllegalArgumentException(); localState.lock.lock(); try { localState.setRunState(RunState.Aborted); } finally { localState.lock.unlock(); } } finally { clearLoggingContext(); } }
@Override public Void doTask() throws Exception { /* * Note: In this case the [revisionTime] will be LT the * [commitTime]. That's Ok as long as the issued revision times are * strictly increasing, which they are. */ final long revisionTime = localTransactionManager.nextTimestamp(); /* * Lock out other operations on this tx. */ state.lock.lockInterruptibly(); try { // Note: throws ValidationError. state.prepare(revisionTime); } finally { state.lock.unlock(); } return null; }
getConcurrencyManager().getTransactionManager().notifyCommit( lastCommitTime);
/** * This exposes the clock used to assign transaction identifiers and * commit times. It is being exposed to support certain kinds of * overrides for unit tests. * <p> * Note: This method is NOT exposed to RMI. However, it can still be * overridden by the unit tests. * * @return The next timestamp from that clock. */ public long nextTimestamp() { try { return AbstractJournal.this.getLocalTransactionManager() .getTransactionService().nextTimestamp(); } catch (IOException ex) { /* * Note: This is a local method call. IOException will not be * thrown. */ throw new RuntimeException(ex); } }
final ITx tx = getLocalTransactionManager().getTx(timestamp);
/** * Report the next timestamp assigned by the {@link ITransactionService}. */ protected long nextTimestamp() { final ILocalTransactionManager transactionManager = getConcurrencyManager() .getTransactionManager(); return transactionManager.nextTimestamp(); }
getConcurrencyManager().getTransactionManager().notifyCommit( lastCommitTime);
/** * This exposes the clock used to assign transaction identifiers and * commit times. It is being exposed to support certain kinds of * overrides for unit tests. * <p> * Note: This method is NOT exposed to RMI. However, it can still be * overridden by the unit tests. * * @return The next timestamp from that clock. */ public long nextTimestamp() { try { return AbstractJournal.this.getLocalTransactionManager() .getTransactionService().nextTimestamp(); } catch (IOException ex) { /* * Note: This is a local method call. IOException will not be * thrown. */ throw new RuntimeException(ex); } }
final ITx tx = getLocalTransactionManager().getTx(timestamp);
/** * Report the next timestamp assigned by the {@link ITransactionService}. */ protected long nextTimestamp() { final ILocalTransactionManager transactionManager = getConcurrencyManager() .getTransactionManager(); return transactionManager.nextTimestamp(); }
/** * Return the {@link ITransactionService}. */ protected ITransactionService getTxService() { final IIndexManager indexManager = getIndexManager(); final ITransactionService txService; if (indexManager instanceof IJournal) { txService = ((IJournal) indexManager).getLocalTransactionManager() .getTransactionService(); } else { txService = ((AbstractFederation<?>) indexManager) .getTransactionService(); } return txService; }
final Tx state = (Tx) getLocalTransactionManager().getTx(tx);