/** * Release the passed <code>syncFuture</code> * @return Returns 1. */ private int releaseSyncFuture(final SyncFuture syncFuture, final long currentSequence, final Throwable t) { if (!syncFuture.done(currentSequence, t)) { throw new IllegalStateException(); } // This function releases one sync future only. return 1; }
private void cleanupOutstandingSyncsOnException(final long sequence, final Exception e) { // There could be handler-count syncFutures outstanding. for (int i = 0; i < this.syncFuturesCount.get(); i++) { this.syncFutures[i].done(sequence, e); } this.syncFuturesCount.set(0); }
private int finishSyncLowerThanTxid(long txid, boolean addSyncTrace) { int finished = 0; for (Iterator<SyncFuture> iter = syncFutures.iterator(); iter.hasNext();) { SyncFuture sync = iter.next(); if (sync.getTxid() <= txid) { sync.done(txid, null); iter.remove(); finished++; if (addSyncTrace) { addTimeAnnotation(sync, "writer synced"); } } else { break; } } return finished; }
SyncFuture future = syncIter.next(); if (future.getTxid() < txid) { future.done(future.getTxid(), error); syncIter.remove(); } else {
for (SyncFuture sync : syncFutures) { maxSyncTxid = Math.max(maxSyncTxid, sync.getTxid()); sync.done(maxSyncTxid, null); if (addSyncTrace) { addTimeAnnotation(sync, "writer synced");
syncFutures.forEach(f -> f.done(f.getTxid(), error)); if (!(consumeExecutor instanceof EventLoop)) { consumeExecutor.shutdown();
@Test(expected = TimeoutIOException.class) public void testGet() throws Exception { long timeout = 5000; long txid = 100000; SyncFuture syncFulture = new SyncFuture().reset(txid); syncFulture.done(txid, null); assertEquals(txid, syncFulture.get(timeout)); syncFulture.reset(txid).get(timeout); } }
private void cleanupOutstandingSyncsOnException(final long sequence, final Exception e) { // There could be handler-count syncFutures outstanding. for (int i = 0; i < this.syncFuturesCount; i++) this.syncFutures[i].done(sequence, e); this.syncFuturesCount = 0; }
/** * Release the passed <code>syncFuture</code> * @param syncFuture * @param currentSequence * @param t * @return Returns 1. */ private int releaseSyncFuture(final SyncFuture syncFuture, final long currentSequence, final Throwable t) { if (!syncFuture.done(currentSequence, t)) throw new IllegalStateException(); // This function releases one sync future only. return 1; }
@Test(expected = TimeoutIOException.class) public void testGet() throws Exception { long timeout = 5000; long txid = 100000; SyncFuture syncFulture = new SyncFuture().reset(txid); syncFulture.done(txid, null); assertEquals(txid, syncFulture.get(timeout)); syncFulture.reset(txid).get(timeout); } }