Package net.spy.memcached.ops

Examples of net.spy.memcached.ops.OperationStatus


          observeFuture.set(replaceStatus, future.getStatus());
          if (future.getCas() != null) {
            observeFuture.setCas(future.getCas());
          }
        } catch (InterruptedException e) {
          observeFuture.set(false, new OperationStatus(false, prefix + " get "
            + "timed out"));
        } catch (ExecutionException e) {
          if(e.getCause() instanceof CancellationException) {
            observeFuture.set(false, new OperationStatus(false, prefix + " get "
              + "cancellation exception "));
          } else {
            observeFuture.set(false, new OperationStatus(false, prefix + " get "
              + "execution exception "));
          }
        }

        if (!replaceStatus) {
          latch.countDown();
          observeFuture.signalComplete();
          return;
        }

        try {
          observePoll(key, future.getCas(), req, rep, delete);
          observeFuture.set(true, future.getStatus());
        } catch (ObservedException e) {
          observeFuture.set(false, new OperationStatus(false, e.getMessage()));
        } catch (ObservedTimeoutException e) {
          observeFuture.set(false, new OperationStatus(false, e.getMessage()));
        } catch (ObservedModifiedException e) {
          observeFuture.set(false, new OperationStatus(false, e.getMessage()));
        }

        latch.countDown();
        observeFuture.signalComplete();
      }
View Full Code Here


        try {
          observePoll(key, future.getCas(), req, rep, false);
          observeFuture.set(casr, future.getStatus());
        } catch (ObservedException e) {
          observeFuture.set(CASResponse.OBSERVE_ERROR_IN_ARGS,
            new OperationStatus(false, e.getMessage()));
        } catch (ObservedTimeoutException e) {
          observeFuture.set(CASResponse.OBSERVE_TIMEOUT,
            new OperationStatus(false, e.getMessage()));
        } catch (ObservedModifiedException e) {
          observeFuture.set(CASResponse.OBSERVE_MODIFIED,
            new OperationStatus(false, e.getMessage()));
        }

        latch.countDown();
        observeFuture.signalComplete();
      }
View Full Code Here

          observeFuture.set(replaceStatus, future.getStatus());
          if (future.getCas() != null) {
            observeFuture.setCas(future.getCas());
          }
        } catch (InterruptedException e) {
          observeFuture.set(false, new OperationStatus(false, prefix + " get "
            + "timed out"));
        } catch (ExecutionException e) {
          if(e.getCause() instanceof CancellationException) {
            observeFuture.set(false, new OperationStatus(false, prefix + " get "
              + "cancellation exception "));
          } else {
            observeFuture.set(false, new OperationStatus(false, prefix + " get "
              + "execution exception "));
          }
        }

        if (!replaceStatus) {
          latch.countDown();
          observeFuture.signalComplete();
          return;
        }

        try {
          observePoll(key, future.getCas(), req, rep, delete);
          observeFuture.set(true, future.getStatus());
        } catch (ObservedException e) {
          observeFuture.set(false, new OperationStatus(false, e.getMessage()));
        } catch (ObservedTimeoutException e) {
          observeFuture.set(false, new OperationStatus(false, e.getMessage()));
        } catch (ObservedModifiedException e) {
          observeFuture.set(false, new OperationStatus(false, e.getMessage()));
        }

        latch.countDown();
        observeFuture.signalComplete();
      }
View Full Code Here

        try {
          observePoll(key, future.getCas(), req, rep, false);
          observeFuture.set(casr, future.getStatus());
        } catch (ObservedException e) {
          observeFuture.set(CASResponse.OBSERVE_ERROR_IN_ARGS,
            new OperationStatus(false, e.getMessage()));
        } catch (ObservedTimeoutException e) {
          observeFuture.set(CASResponse.OBSERVE_TIMEOUT,
            new OperationStatus(false, e.getMessage()));
        } catch (ObservedModifiedException e) {
          observeFuture.set(CASResponse.OBSERVE_MODIFIED,
            new OperationStatus(false, e.getMessage()));
        }

        latch.countDown();
        observeFuture.signalComplete();
      }
View Full Code Here

    prepareBuffer("", 0, EMPTY_BYTES);
  }

  @Override
  protected void decodePayload(byte[] pl) {
    getCallback().receivedStatus(new OperationStatus(true, new String(pl)));
  }
View Full Code Here

  @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);
    }
  }
View Full Code Here

    throws InterruptedException, TimeoutException, ExecutionException {
    if (!latch.await(duration, units)) {
      if (op != null) {
        op.timeOut();
      }
      status = new OperationStatus(false, "Timed out");
      throw new TimeoutException("Timed out waiting for operation");
    }

    if (op != null && op.hasErrored()) {
      status = new OperationStatus(false, op.getException().getMessage());
      throw new ExecutionException(op.getException());
    }

    if (op != null && op.isCancelled()) {
      status = new OperationStatus(false, "Operation Cancelled");
      throw new ExecutionException(new CancellationException("Cancelled"));
    }

    if (op != null && op.isTimedOut()) {
      status = new OperationStatus(false, "Timed out");
      throw new ExecutionException(new CheckedOperationTimeoutException(
          "Operation timed out.", (Operation)op));
    }
  }
View Full Code Here

  public OperationStatus getStatus() {
    if (status == null) {
      try {
        get();
      } catch (InterruptedException e) {
        status = new OperationStatus(false, "Interrupted");
        Thread.currentThread().isInterrupted();
      } catch (ExecutionException e) {
        getLogger().warn("Error getting status of operation", e);
      }
    }
View Full Code Here

    return errCode == ERR_NOT_FOUND ? NOT_FOUND_STATUS : null;
  }

  @Override
  protected void decodePayload(byte[] pl) {
    getCallback().receivedStatus(new OperationStatus(true,
      String.valueOf(decodeLong(pl, 0))));
  }
View Full Code Here

    prepareBuffer(key, cas, data, flags, exp);
  }

  @Override
  protected OperationStatus getStatusForErrorCode(int errCode, byte[] errPl) {
    OperationStatus rv=null;
    switch(errCode) {
      case ERR_EXISTS:
        rv=EXISTS_STATUS;
        break;
      case ERR_NOT_FOUND:
View Full Code Here

TOP

Related Classes of net.spy.memcached.ops.OperationStatus

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.