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 receivedStatus(OperationStatus s) { rv.set(new Long(s.isSuccess() ? s.getMessage() : "-1")); final MemcachedNode node = getEVCacheNode(key); if(node instanceof EVCacheNodeImpl) { getCounter("MutateOperation-"+ s.getStatusCode().name(), ((EVCacheNodeImpl)node).getBaseTags()).increment(); } else { getCounter("MutateOperation-"+ s.getStatusCode().name(), BasicTagList.of("HOST", node.getSocketAddress().toString())).increment(); } }
@Override public void receivedStatus(OperationStatus val) { if (val.getStatusCode().equals(StatusCode.SUCCESS)) { if (log.isDebugEnabled()) log.debug("AddOrAppend Key (Append Operation): " + key + "; Status : " + val.getStatusCode().name() + "; Message : " + val.getMessage() + "; Elapsed Time - " + (operationDuration.getDuration(TimeUnit.MILLISECONDS))); getCounter(AOA_APPEND_OPERATION_SUCCESS_STRING).increment(); rv.set(Boolean.TRUE, val); appendSuccess = true; } else { getCounter("AoA-AppendOperation-"+ val.getStatusCode().name()).increment(); } }
/** * 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 CollectionOperationStatus getOperationStatus() { if (isCancelled()) return new CollectionOperationStatus(new OperationStatus(false, "CANCELED")); return new CollectionOperationStatus(new OperationStatus(true, "END")); } }
@Override public void receivedStatus(OperationStatus status) { operationDuration.stop(); rv.set(status.isSuccess(), status); if (status.getStatusCode().equals(StatusCode.SUCCESS)) { getCounter(TOUCH_OPERATION_STRING + "-SUCCESS").increment(); } else { if (status.getStatusCode().equals(StatusCode.TIMEDOUT)) { final MemcachedNode node = getEVCacheNode(key); if(node instanceof EVCacheNodeImpl) { getCounter(TOUCH_OPERATION_STRING + "-" + status.getStatusCode().name(), ((EVCacheNodeImpl)node).getBaseTags()).increment(); } else { getCounter(TOUCH_OPERATION_STRING + "-"+ status.getStatusCode().name(), BasicTagList.of("HOST", node.getSocketAddress().toString())).increment(); } } else { getCounter(TOUCH_OPERATION_STRING + "-"+ status.getStatusCode().name()).increment(); } } }
@Override public void receivedStatus(OperationStatus status) { versions.put(sa, status.getMessage()); }
/** * Match the status line provided against one of the given OperationStatus * objects. If none match, return a failure status with the given line. * * @param line the current line * @param statii several status objects * @return the appropriate status object */ protected final OperationStatus matchStatus(String line, OperationStatus... statii) { OperationStatus rv = null; for (OperationStatus status : statii) { if (line.equals(status.getMessage())) { rv = status; } } if (rv == null) { rv = new OperationStatus(false, line, StatusCode.fromAsciiLine(line)); } return rv; }
@Override public void receivedStatus(OperationStatus status) { operationDuration.stop(); rv.set(Boolean.TRUE, status); if (status.getStatusCode().equals(StatusCode.SUCCESS)) { getCounter(DELETE_OPERATION_SUCCESS_STRING).increment(); } else { if (status.getStatusCode().equals(StatusCode.TIMEDOUT)) { final MemcachedNode node = getEVCacheNode(key); if(node instanceof EVCacheNodeImpl) { getCounter("DeleteOperation-"+ status.getStatusCode().name(), ((EVCacheNodeImpl)node).getBaseTags()).increment(); } else { getCounter("DeleteOperation-"+ status.getStatusCode().name(), BasicTagList.of("HOST", node.getSocketAddress().toString())).increment(); } } else { getCounter("DeleteOperation-"+ status.getStatusCode().name()).increment(); } } }
@Override public void receivedStatus(OperationStatus val) { rv.set(val.isSuccess(), val); } @Override
@Override public Boolean get(long duration, TimeUnit units) throws InterruptedException, TimeoutException, ExecutionException { status = new OperationStatus(true, "OK", StatusCode.SUCCESS); return super.get(duration, units); }
@Override public void receivedStatus(OperationStatus status) { future.set(val, status); if (!replicaFuture.isDone() && (status.isSuccess() || status.getStatusCode() == StatusCode.ERR_NOT_FOUND)) { usedFuture = replicaFuture.setCompletedFuture(future); } }
@Override public void receivedStatus(OperationStatus status) { crv.set(status.getMessage().equals("Error Code: 201"), status); }
@Override @SuppressWarnings("synthetic-access") public void receivedStatus(OperationStatus status) { operationDuration.stop(); if (log.isDebugEnabled()) log.debug("GetBulk Keys : " + keys + "; Status : " + status.getStatusCode().name() + "; Message : " + status.getMessage() + "; Elapsed Time - " + operationDuration.getDuration(TimeUnit.MILLISECONDS)); if (status.getStatusCode().equals(StatusCode.SUCCESS)) { getCounter(BULK_OPERATION_STRING + "-SUCCESS").increment(); } else { getCounter(BULK_OPERATION_STRING + "-" + status.getStatusCode().name()).increment();//First lets get some data and then we can add Host info } rv.setStatus(status); }
if(future instanceof EVCacheOperationFuture) { final EVCacheOperationFuture<Boolean> f = (EVCacheOperationFuture<Boolean>)future; if(f.getStatus().getStatusCode() == StatusCode.SUCCESS) { successCount++; if(log.isDebugEnabled()) log.debug("ADD : Success : APP " + _appName + ", key " + canonicalKey+ ", ServerGroup : " + f.getServerGroup().getName()); if(evFuture instanceof EVCacheOperationFuture) { final EVCacheOperationFuture<Boolean> f = (EVCacheOperationFuture<Boolean>)evFuture; if(f.getStatus().getStatusCode() == StatusCode.ERR_EXISTS) { final EVCacheClient client = _pool.getEVCacheClient(f.getServerGroup()); if(client != null) { if(evFuture instanceof OperationFuture) { final EVCacheOperationFuture<Boolean> f = (EVCacheOperationFuture<Boolean>)evFuture; if(f.getStatus().getStatusCode() == StatusCode.SUCCESS) { final EVCacheClient client = _pool.getEVCacheClient(f.getServerGroup()); if(client != null) {
public void receivedStatus(OperationStatus s) { // XXX: Potential abstraction leak. // The handling of incr/decr in the binary protocol // Allows us to avoid string processing. rv.set(new Long(s.isSuccess()?s.getMessage():"-1")); } public void complete() {
@Override public void receivedStatus(OperationStatus val) { rv.set(val.isSuccess(), val); } @Override
@Override public T get() throws InterruptedException, ExecutionException { try { return get(timeout, TimeUnit.MILLISECONDS); } catch (TimeoutException e) { status = new OperationStatus(false, "Timed out"); throw new RuntimeException("Timed out waiting for operation", e); } }
@Override public void receivedStatus(OperationStatus val) { operationDuration.stop(); if (log.isDebugEnabled()) log.debug("Storing Key : " + key + "; Status : " + val.getStatusCode().name() + (log.isTraceEnabled() ? " Node : " + getEVCacheNode(key) : "") + "; Message : " + val.getMessage() + "; Elapsed Time - " + operationDuration.getDuration(TimeUnit.MILLISECONDS)); if (val.getStatusCode().equals(StatusCode.SUCCESS)) { getCounter(operationSuccessStr).increment(); } else { if (val.getStatusCode().equals(StatusCode.TIMEDOUT)) { final MemcachedNode node = getEVCacheNode(key); if(node instanceof EVCacheNodeImpl) { if (log.isInfoEnabled()) log.info(val.getStatusCode().name() + " Storing Key : " + key + "; Status : " + val.getStatusCode().name() + "; Node : " + node + "; Message : " + val.getMessage() + "; Elapsed Time - " + operationDuration.getDuration(TimeUnit.MILLISECONDS), new Exception()); if(node instanceof EVCacheNodeImpl) { getCounter(operationStr + "-" + val.getStatusCode().name(), ((EVCacheNodeImpl)node).getBaseTags()).increment(); } else { getCounter(operationStr + "-" + val.getStatusCode().name(), BasicTagList.of("HOST", node.getSocketAddress().toString())).increment(); } } } else { getCounter(operationStr + "-" + val.getStatusCode().name()).increment(); } } rv.set(val.isSuccess(), val); }
@Override public void receivedStatus(OperationStatus status) { future.set(val, status); if (!replicaFuture.isDone() && (status.isSuccess() || status.getStatusCode() == StatusCode.ERR_NOT_FOUND)) { usedFuture = replicaFuture.setCompletedFuture(future); } }