Package net.spy.memcached.ops

Examples of net.spy.memcached.ops.OperationCallback


      String key, int exp, Object value) {
    CachedData co=transcoder.encode(value);
    final CountDownLatch latch=new CountDownLatch(1);
    final OperationFuture<Boolean> rv=new OperationFuture<Boolean>(latch);
    Operation op=opFact.store(storeType, key, co.getFlags(),
        exp, co.getData(), new OperationCallback() {
          public void receivedStatus(OperationStatus val) {
            rv.set(val.isSuccess());
          }
          public void complete() {
            latch.countDown();
View Full Code Here


    CountDownLatch blatch = broadcastOp(new BroadcastOpFactory(){
      public Operation newOp(final MemcachedNode n,
          final CountDownLatch latch) {
        final SocketAddress sa=n.getSocketAddress();
        return opFact.version(
            new OperationCallback() {
              public void receivedStatus(OperationStatus s) {
                rv.put(sa, s.getMessage());
              }
              public void complete() {
                latch.countDown();
View Full Code Here

  }

  private long mutate(Mutator m, String key, int by, long def, int exp) {
    final AtomicLong rv=new AtomicLong();
    final CountDownLatch latch=new CountDownLatch(1);
    addOp(key, opFact.mutate(m, key, by, def, exp, new OperationCallback() {
          public void receivedStatus(OperationStatus s) {
            // XXX:  Potential abstraction leak.
            // The handling of incr/decr in the binary protocol is
            // yet undefined.
            rv.set(new Long(s.isSuccess()?s.getMessage():"-1"));
View Full Code Here

   */
  public Future<Boolean> delete(String key, int when) {
    final CountDownLatch latch=new CountDownLatch(1);
    final OperationFuture<Boolean> rv=new OperationFuture<Boolean>(latch);
    DeleteOperation op=opFact.delete(key, when,
        new OperationCallback() {
          public void receivedStatus(OperationStatus s) {
            rv.set(s.isSuccess());
          }
          public void complete() {
            latch.countDown();
View Full Code Here

    final ConcurrentLinkedQueue<Operation> ops=
      new ConcurrentLinkedQueue<Operation>();
    CountDownLatch blatch = broadcastOp(new BroadcastOpFactory(){
      public Operation newOp(final MemcachedNode n,
          final CountDownLatch latch) {
        Operation op=opFact.flush(delay, new OperationCallback(){
          public void receivedStatus(OperationStatus s) {
            flushResult.set(s.isSuccess());
          }
          public void complete() {
            latch.countDown();
View Full Code Here

  public boolean waitForQueues(long timeout, TimeUnit unit) {
    CountDownLatch blatch = broadcastOp(new BroadcastOpFactory(){
      public Operation newOp(final MemcachedNode n,
          final CountDownLatch latch) {
        return opFact.noop(
            new OperationCallback() {
              public void complete() {
                latch.countDown();
              }
              public void receivedStatus(OperationStatus s) {
                // Nothing special when receiving status, only
View Full Code Here

    request.setHeader(new BasicHeader("Content-Type", "application/json"));
    StringEntity entity = new StringEntity(value);
    ((BasicHttpEntityEnclosingRequest) request).setEntity(entity);

    HttpOperationImpl op = new DesignDocOperationImpl(request,
      new OperationCallback() {
        @Override
        public void receivedStatus(OperationStatus status) {
          crv.set(status.getMessage().equals("Error Code: 201"), status);
        }
View Full Code Here

    HttpRequest request = new BasicHttpEntityEnclosingRequest("DELETE", uri,
            HttpVersion.HTTP_1_1);
    request.setHeader(new BasicHeader("Content-Type", "application/json"));

    HttpOperationImpl op = new DesignDocOperationImpl(request,
      new OperationCallback() {
        @Override
        public void receivedStatus(OperationStatus status) {
          crv.set(status.getMessage().equals("Error Code: 200"), status);
        }
View Full Code Here

  public <T> OperationFuture<Boolean> asyncUnlock(final String key,
          long casId, final Transcoder<T> tc) {
    final CountDownLatch latch = new CountDownLatch(1);
    final OperationFuture<Boolean> rv = new OperationFuture<Boolean>(key,
            latch, operationTimeout, executorService);
    Operation op = opFact.unlock(key, casId, new OperationCallback() {

      @Override
      public void receivedStatus(OperationStatus s) {
        rv.set(s.isSuccess(), s);
      }
View Full Code Here

    CountDownLatch blatch = connection.broadcastOperation(
      new BroadcastOpFactory() {
        @Override
        public Operation newOp(MemcachedNode n, final CountDownLatch latch) {
          return new GetConfigOperationImpl(new OperationCallback() {
            @Override
            public void receivedStatus(OperationStatus status) {
              if (status.isSuccess()) {
                configs.add(status.getMessage());
              }
View Full Code Here

TOP

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

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.