if (op != null) op.timeOut(); TagList tags = null; if(op.getHandlingNode() instanceof EVCacheNodeImpl) {
public Single<T> get(long duration, TimeUnit units, boolean throwException, boolean hasZF, Scheduler scheduler) { return observe().timeout(duration, units, Single.create(subscriber -> { // whenever timeout occurs, continuous timeout counter will increase by 1. MemcachedConnection.opTimedOut(op); if (op != null) op.timeOut(); if (!hasZF) EVCacheMetricsFactory.getCounter(appName, null, serverGroup.getName(), appName + "-get-CheckedOperationTimeout", DataSourceType.COUNTER).increment(); if (throwException) { subscriber.onError(new CheckedOperationTimeoutException("Timed out waiting for operation", op)); } else { if (isCancelled()) { if (hasZF) EVCacheMetricsFactory.getCounter(appName, null, serverGroup.getName(), appName + "-get-Cancelled", DataSourceType.COUNTER).increment(); } subscriber.onSuccess(objRef.get()); } }), scheduler).doAfterTerminate(new Action0() { @Override public void call() { } } ); }
@Override public synchronized void timeOut() { timedout = true; synchronized (clones) { Iterator<Operation> i = clones.iterator(); while(i.hasNext()) { i.next().timeOut(); } } callback.receivedStatus(TIMED_OUT); callback.complete(); }
@Override public synchronized void timeOut() { timedout = true; synchronized (clones) { Iterator<Operation> i = clones.iterator(); while(i.hasNext()) { i.next().timeOut(); } } callback.receivedStatus(TIMED_OUT); callback.complete(); }
public T get(long duration, TimeUnit units) throws InterruptedException, TimeoutException, ExecutionException { if(!latch.await(duration, units)) { // whenever timeout occurs, continuous timeout counter will increase by 1. MemcachedConnection.opTimedOut(op); if (op != null) { // op can be null on a flush op.timeOut(); } throw new CheckedOperationTimeoutException( "Timed out waiting for operation", op); } else { // continuous timeout counter will be reset MemcachedConnection.opSucceeded(op); } if(op != null && op.hasErrored()) { throw new ExecutionException(op.getException()); } if(isCancelled()) { throw new ExecutionException(new RuntimeException("Cancelled")); } if(op != null && op.isTimedOut()) { throw new ExecutionException(new CheckedOperationTimeoutException("Operation timed out.", op)); } return objRef.get(); }