@Override public boolean isDone() { for (OperationFuture<Boolean> future : futures) { if (future.isDone() == false) return false; } return true; }
@Override public Boolean get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { for (OperationFuture<Boolean> future : futures) { if (future.get(timeout, unit) == false) return false; } return true; }
@Override public boolean isCancelled() { for (OperationFuture<Boolean> future : futures) { if (future.isCancelled() == false) return false; } return true; }
public boolean cancel(boolean mayInterruptIfRunning) { if(log.isDebugEnabled()) log.debug("Operation cancelled", new Exception()); for (OperationFuture<Boolean> future : futures) { future.cancel(); } return true; }
/** * Wrapper method that either inspects the future or not. * * @param future the future to potentially verify. * @return the status of the future result. */ private Status checkFutureStatus(final OperationFuture<?> future) { if (checkFutures) { return future.getStatus().isSuccess() ? Status.OK : Status.ERROR; } else { return Status.OK; } }
public void setOperation(Operation to) { this.op = to; super.setOperation(to); }
public void signalComplete() { super.signalComplete(); }
@Override public void gotData(long cas) { rv.setCas(cas); }
public void signalComplete() { super.signalComplete(); }
public void addFuture(ListenableFuture<Boolean, OperationCompletionListener> future) { future.addListener(this); if (future.isDone()) countDown(); this.futures.add(future); }
public EVCacheOperationFuture<T> removeListener(EVCacheGetOperationListener<T> listener) { super.removeFromListeners(listener); return this; }
public EVCacheOperationFuture<T> addListener(EVCacheGetOperationListener<T> listener) { super.addToListeners(listener); return this; }
public boolean cancel(boolean ign) { if(log.isDebugEnabled()) log.debug("Operation cancelled", new Exception()); return super.cancel(ign); }
@Override public Boolean get() throws InterruptedException, ExecutionException { for (OperationFuture<Boolean> future : futures) { if (future.get() == false) return false; } return true; }
/** * Cancel this operation, if possible. * * @return true if the operation has not yet been written to the network */ public boolean cancel() { if(log.isDebugEnabled()) log.debug("Operation cancelled", new Exception()); return super.cancel(); }
protected Status getReturnCode(OperationFuture<Boolean> future) { if (!checkOperationStatus) { return Status.OK; } if (future.getStatus().isSuccess()) { return Status.OK; } else if (TEMPORARY_FAILURE_MSG.equals(future.getStatus().getMessage())) { return new Status("TEMPORARY_FAILURE", TEMPORARY_FAILURE_MSG); } else if (CANCELLED_MSG.equals(future.getStatus().getMessage())) { return new Status("CANCELLED_MSG", CANCELLED_MSG); } return new Status("ERROR", future.getStatus().getMessage()); }
@Override public void complete() { latch.countDown(); rv.signalComplete(); } };
private boolean putInternal(final CouchbaseClient client, final String key, final V value) { try { return client.set(key, value) .get(); } catch (InterruptedException | ExecutionException e) { throw ExceptionSoftener.throwSoftenedException(e); } }
/** * Cancel this operation, if possible. * * @param ign not used * @deprecated * @return true if the operation has not yet been written to the network */ public boolean cancel(boolean ign) { if(log.isDebugEnabled()) log.debug("Operation cancelled", new Exception()); return super.cancel(ign); }
@Override public void complete() { latch.countDown(); rv.signalComplete(); } });