Package net.spy.memcached.internal
Class GetFuture<T>
- java.lang.Object
-
- net.spy.memcached.compat.SpyObject
-
- net.spy.memcached.internal.AbstractListenableFuture<T,GetCompletionListener>
-
- net.spy.memcached.internal.GetFuture<T>
-
- Type Parameters:
T- Type of object returned from the get
- All Implemented Interfaces:
java.util.concurrent.Future<T>,ListenableFuture<T,GetCompletionListener>
public class GetFuture<T> extends AbstractListenableFuture<T,GetCompletionListener> implements java.util.concurrent.Future<T>
Future returned for GET operations. Not intended for general use.
-
-
Field Summary
Fields Modifier and Type Field Description private OperationFuture<java.util.concurrent.Future<T>>rv
-
Constructor Summary
Constructors Constructor Description GetFuture(java.util.concurrent.CountDownLatch l, long opTimeout, java.lang.String key, java.util.concurrent.ExecutorService service)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description GetFuture<T>addListener(GetCompletionListener listener)Add a listener to the future, which will be executed once the operation completes.booleancancel(boolean ign)Tget()Tget(long duration, java.util.concurrent.TimeUnit units)OperationStatusgetStatus()booleanisCancelled()booleanisDone()GetFuture<T>removeListener(GetCompletionListener listener)Remove a previously added listener from the future.voidset(java.util.concurrent.Future<T> d, OperationStatus s)voidsetOperation(Operation to)voidsignalComplete()Signals that this future is complete.-
Methods inherited from class net.spy.memcached.internal.AbstractListenableFuture
addToListeners, executor, notifyListener, notifyListeners, notifyListeners, removeFromListeners
-
-
-
-
Field Detail
-
rv
private final OperationFuture<java.util.concurrent.Future<T>> rv
-
-
Method Detail
-
cancel
public boolean cancel(boolean ign)
- Specified by:
cancelin interfacejava.util.concurrent.Future<T>
-
get
public T get() throws java.lang.InterruptedException, java.util.concurrent.ExecutionException
- Specified by:
getin interfacejava.util.concurrent.Future<T>- Throws:
java.lang.InterruptedExceptionjava.util.concurrent.ExecutionException
-
get
public T get(long duration, java.util.concurrent.TimeUnit units) throws java.lang.InterruptedException, java.util.concurrent.TimeoutException, java.util.concurrent.ExecutionException
- Specified by:
getin interfacejava.util.concurrent.Future<T>- Throws:
java.lang.InterruptedExceptionjava.util.concurrent.TimeoutExceptionjava.util.concurrent.ExecutionException
-
getStatus
public OperationStatus getStatus()
-
set
public void set(java.util.concurrent.Future<T> d, OperationStatus s)
-
setOperation
public void setOperation(Operation to)
-
isCancelled
public boolean isCancelled()
- Specified by:
isCancelledin interfacejava.util.concurrent.Future<T>
-
isDone
public boolean isDone()
- Specified by:
isDonein interfacejava.util.concurrent.Future<T>
-
addListener
public GetFuture<T> addListener(GetCompletionListener listener)
Description copied from interface:ListenableFutureAdd a listener to the future, which will be executed once the operation completes.- Specified by:
addListenerin interfaceListenableFuture<T,GetCompletionListener>- Parameters:
listener- the listener which will be executed.- Returns:
- the current future to allow for object-chaining.
-
removeListener
public GetFuture<T> removeListener(GetCompletionListener listener)
Description copied from interface:ListenableFutureRemove a previously added listener from the future.- Specified by:
removeListenerin interfaceListenableFuture<T,GetCompletionListener>- Parameters:
listener- the previously added listener.- Returns:
- the current future to allow for object-chaining.
-
signalComplete
public void signalComplete()
Signals that this future is complete.
-
-