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.boolean
cancel(boolean ign)
T
get()
T
get(long duration, java.util.concurrent.TimeUnit units)
OperationStatus
getStatus()
boolean
isCancelled()
boolean
isDone()
GetFuture<T>
removeListener(GetCompletionListener listener)
Remove a previously added listener from the future.void
set(java.util.concurrent.Future<T> d, OperationStatus s)
void
setOperation(Operation to)
void
signalComplete()
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:
cancel
in interfacejava.util.concurrent.Future<T>
-
get
public T get() throws java.lang.InterruptedException, java.util.concurrent.ExecutionException
- Specified by:
get
in interfacejava.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.TimeoutException, java.util.concurrent.ExecutionException
- Specified by:
get
in interfacejava.util.concurrent.Future<T>
- Throws:
java.lang.InterruptedException
java.util.concurrent.TimeoutException
java.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:
isCancelled
in interfacejava.util.concurrent.Future<T>
-
isDone
public boolean isDone()
- Specified by:
isDone
in interfacejava.util.concurrent.Future<T>
-
addListener
public GetFuture<T> addListener(GetCompletionListener listener)
Description copied from interface:ListenableFuture
Add a listener to the future, which will be executed once the operation completes.- Specified by:
addListener
in 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:ListenableFuture
Remove a previously added listener from the future.- Specified by:
removeListener
in 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.
-
-