@Override public boolean done(T result) { try { return ActiveOperationImpl.this.setResult(result); } finally { removeActiveOperation(operationId); } }
/** * {@inheritDoc} */ @Override protected <T, A> ActiveOperation<T, A> removeActiveOperation(Integer id) { final ActiveOperation<T, A> removed = super.removeActiveOperation(id); if(removed != null) { for(final Map.Entry<Integer, ActiveRequest<?, ?>> requestEntry : requests.entrySet()) { final ActiveRequest<?, ?> request = requestEntry.getValue(); if(request.context == removed) { requests.remove(requestEntry.getKey()); } } } return removed; }
@Override public boolean failed(Exception e) { try { boolean failed = ActiveOperationImpl.this.setFailed(e); if(failed) { ProtocolLogger.ROOT_LOGGER.debugf(e, "active-op (%d) failed %s", operationId, attachment); } return failed; } finally { removeActiveOperation(operationId); } }
@Override public void handleCancelled(AsyncFuture<? extends T> asyncFuture, Object attachment) { removeActiveOperation(operationId); callback.cancelled(); ProtocolLogger.ROOT_LOGGER.debugf("cancelled operation (%d) attachment: (%s) this: %s.", getOperationId(), getAttachment(), ActiveOperationSupport.this); } }, null);