public BoxedUnit apply() { writePendingStat.dec(); return null; } });
public BoxedUnit apply() { bulkWritePendingStat.dec(); return null; } });
public BoxedUnit apply() { pendingWrites.dec(); writeLimiter.release(); return null; } });
@Override public Future<Rep> apply(Req req, Service<Req, Rep> service) { Future<Rep> result = null; outstandingAsync.inc(); final Stopwatch stopwatch = Stopwatch.createStarted(); try { result = service.apply(req); serviceExec.registerSuccessfulEvent(stopwatch.stop().elapsed(TimeUnit.MICROSECONDS)); } finally { outstandingAsync.dec(); if (null == result) { serviceExec.registerFailedEvent(stopwatch.stop().elapsed(TimeUnit.MICROSECONDS)); } } return result; }
private void closeManagerAndErrorOutPendingRequests() { close(manager); // Failed the pending requests. Queue<StreamOp> oldPendingOps; synchronized (this) { oldPendingOps = pendingOps; pendingOps = new ArrayDeque<StreamOp>(); } StreamUnavailableException closingException = new StreamUnavailableException("Stream " + name + " is closed."); for (StreamOp op : oldPendingOps) { op.fail(closingException); pendingOpsCounter.dec(); } limiter.close(); logger.info("Closed stream {}.", name); }
void processPendingRequestsAfterOpen(boolean success, AsyncLogWriter oldWriter, Queue<StreamOp> oldPendingOps) { if (success) { streamAcquireStat.registerSuccessfulEvent(stopwatch.elapsed(TimeUnit.MICROSECONDS)); } else { streamAcquireStat.registerFailedEvent(stopwatch.elapsed(TimeUnit.MICROSECONDS)); } for (StreamOp op : oldPendingOps) { executeOp(op, success); pendingOpsCounter.dec(); } Abortables.asyncAbort(oldWriter, true); FutureUtils.setValue(acquirePromise, success); } }, scheduler, getStreamName()));
} catch (IOException ex) { writeLimiter.release(); pendingWrites.dec(); positionWithinLogSegment--; throw ex;
public BoxedUnit apply() { bulkWritePendingStat.dec(); return null; } });
public BoxedUnit apply() { writePendingStat.dec(); return null; } });
@Override public void dec() { counter.dec(); }
@Override public void handleV2Response( long ledgerId, long entryId, StatusCode status, BookieProtocol.Response response) { addEntryOutstanding.dec(); handleResponse(ledgerId, entryId, status); }
public void close(boolean wait) { LOG.info("Closing the per channel bookie client for {}", addr); closeLock.writeLock().lock(); try { if (ConnectionState.CLOSED == state) { return; } state = ConnectionState.CLOSED; errorOutOutstandingEntries(BKException.Code.ClientClosedException); } finally { closeLock.writeLock().unlock(); } if (channel != null && channel.pipeline().get(SslHandler.class) != null) { activeTlsChannelCounter.dec(); } else { activeNonTlsChannelCounter.dec(); } closeInternal(true, wait); }
@Override public void handleV2Response(long ledgerId, long entryId, StatusCode status, BookieProtocol.Response response) { readEntryOutstanding.dec(); if (!(response instanceof BookieProtocol.ReadResponse)) { return; } BookieProtocol.ReadResponse readResponse = (BookieProtocol.ReadResponse) response; handleReadResponse(ledgerId, entryId, status, readResponse.getData(), INVALID_ENTRY_ID, -1L); }
@Override public Future<Rep> apply(Req req, Service<Req, Rep> service) { Future<Rep> result = null; outstandingAsync.inc(); final Stopwatch stopwatch = Stopwatch.createStarted(); try { result = service.apply(req); serviceExec.registerSuccessfulEvent(stopwatch.stop().elapsed(TimeUnit.MICROSECONDS)); } finally { outstandingAsync.dec(); if (null == result) { serviceExec.registerFailedEvent(stopwatch.stop().elapsed(TimeUnit.MICROSECONDS)); } } return result; }
@Override public void run() { if (LOG.isDebugEnabled()) { LOG.debug("Acknowledge Ledger: {}, Entry: {}", ledgerId, entryId); } journalCbQueueSize.dec(); journalAddEntryStats.registerSuccessfulEvent(MathUtils.elapsedNanos(enqueueTime), TimeUnit.NANOSECONDS); cb.writeComplete(0, ledgerId, entryId, null, ctx); recycle(); }
private synchronized void removedLedgerFromEntryLogMapCache(Long ledgerId, RemovalCause cause) { numOfWriteActiveLedgers.dec(); if (cause.equals(RemovalCause.EXPIRED)) { numOfWriteLedgersRemovedCacheExpiry.inc(); } else if (cause.equals(RemovalCause.SIZE)) { numOfWriteLedgersRemovedCacheMaxSize.inc(); } }
@Override public void handleV3Response( BookkeeperProtocol.Response response) { addEntryOutstanding.dec(); AddResponse addResponse = response.getAddResponse(); StatusCode status = response.getStatus() == StatusCode.EOK ? addResponse.getStatus() : response.getStatus(); handleResponse(addResponse.getLedgerId(), addResponse.getEntryId(), status); }