com.couchbase.client.internal
Class HttpFuture<T>

java.lang.Object
  extended by net.spy.memcached.compat.SpyObject
      extended by com.couchbase.client.internal.HttpFuture<T>
All Implemented Interfaces:
java.util.concurrent.Future<T>
Direct Known Subclasses:
ViewFuture

public class HttpFuture<T>
extends net.spy.memcached.compat.SpyObject
implements java.util.concurrent.Future<T>

A future http response.


Field Summary
protected  java.util.concurrent.CountDownLatch latch
           
protected  java.util.concurrent.atomic.AtomicReference<T> objRef
           
protected  HttpOperation op
           
protected  net.spy.memcached.ops.OperationStatus status
           
protected  long timeout
           
 
Constructor Summary
HttpFuture(java.util.concurrent.CountDownLatch latch, long timeout)
           
 
Method Summary
 boolean cancel(boolean c)
           
 T get()
           
 T get(long duration, java.util.concurrent.TimeUnit units)
           
 net.spy.memcached.ops.OperationStatus getStatus()
           
 boolean isCancelled()
           
 boolean isDone()
           
 void set(T oper, net.spy.memcached.ops.OperationStatus s)
           
 void setOperation(HttpOperation to)
           
protected  void waitForAndCheckOperation(long duration, java.util.concurrent.TimeUnit units)
           
 
Methods inherited from class net.spy.memcached.compat.SpyObject
getLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

objRef

protected final java.util.concurrent.atomic.AtomicReference<T> objRef

latch

protected final java.util.concurrent.CountDownLatch latch

timeout

protected final long timeout

status

protected net.spy.memcached.ops.OperationStatus status

op

protected HttpOperation op
Constructor Detail

HttpFuture

public HttpFuture(java.util.concurrent.CountDownLatch latch,
                  long timeout)
Method Detail

cancel

public boolean cancel(boolean c)
Specified by:
cancel in interface java.util.concurrent.Future<T>

get

public T get()
      throws java.lang.InterruptedException,
             java.util.concurrent.ExecutionException
Specified by:
get in interface java.util.concurrent.Future<T>
Throws:
java.lang.InterruptedException
java.util.concurrent.ExecutionException

get

public T get(long duration,
             java.util.concurrent.TimeUnit units)
      throws java.lang.InterruptedException,
             java.util.concurrent.ExecutionException,
             java.util.concurrent.TimeoutException
Specified by:
get in interface java.util.concurrent.Future<T>
Throws:
java.lang.InterruptedException
java.util.concurrent.ExecutionException
java.util.concurrent.TimeoutException

waitForAndCheckOperation

protected void waitForAndCheckOperation(long duration,
                                        java.util.concurrent.TimeUnit units)
                                 throws java.lang.InterruptedException,
                                        java.util.concurrent.TimeoutException,
                                        java.util.concurrent.ExecutionException
Throws:
java.lang.InterruptedException
java.util.concurrent.TimeoutException
java.util.concurrent.ExecutionException

getStatus

public net.spy.memcached.ops.OperationStatus getStatus()

set

public void set(T oper,
                net.spy.memcached.ops.OperationStatus s)

isDone

public boolean isDone()
Specified by:
isDone in interface java.util.concurrent.Future<T>

setOperation

public void setOperation(HttpOperation to)

isCancelled

public boolean isCancelled()
Specified by:
isCancelled in interface java.util.concurrent.Future<T>


Copyright © 2006-2009 Dustin Sallings, 2009-2012 Couchbase, Inc.