Class BulkGetFuture<T>
java.lang.Object
net.spy.memcached.compat.SpyObject
net.spy.memcached.internal.AbstractListenableFuture<Map<String,T>, BulkGetCompletionListener>
net.spy.memcached.internal.BulkGetFuture<T>
- Type Parameters:
T- types of objects returned from the GET
- All Implemented Interfaces:
Future<Map<String,T>>, BulkFuture<Map<String, T>>, ListenableFuture<Map<String, T>, BulkGetCompletionListener>
public class BulkGetFuture<T>
extends AbstractListenableFuture<Map<String,T>, BulkGetCompletionListener>
implements BulkFuture<Map<String,T>>
Future for handling results from bulk gets.
Not intended for general use.
-
Nested Class Summary
Nested classes/interfaces inherited from interface Future
Future.State -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanprivate final CountDownLatchprivate final Collection<Operation> private OperationStatusprivate boolean -
Constructor Summary
ConstructorsConstructorDescriptionBulkGetFuture(Map<String, Future<T>> m, Collection<Operation> getOps, CountDownLatch l, ExecutorService service) -
Method Summary
Modifier and TypeMethodDescriptionaddListener(BulkGetCompletionListener listener) Add a listener to the future, which will be executed once the operation completes.booleancancel(boolean ign) get()Wait for the operation to complete and return results If operation could not complete within specified timeout, partial result is returned.Gets the status of the operation upon completion.internalGet(long to, TimeUnit unit, Collection<Operation> timedoutOps) refactored code common to both get(long, TimeUnit) and getSome(long, TimeUnit).booleanbooleanisDone()booleanremoveListener(BulkGetCompletionListener listener) Remove a previously added listener from the future.voidvoidSignals that this future is complete.Methods inherited from class AbstractListenableFuture
addToListeners, executor, notifyListener, notifyListeners, notifyListeners, removeFromListenersMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Future
exceptionNow, resultNow, state
-
Field Details
-
rvMap
-
ops
-
latch
-
status
-
cancelled
private boolean cancelled -
timeout
private boolean timeout
-
-
Constructor Details
-
BulkGetFuture
public BulkGetFuture(Map<String, Future<T>> m, Collection<Operation> getOps, CountDownLatch l, ExecutorService service)
-
-
Method Details
-
cancel
-
get
- Specified by:
getin interfaceFuture<T>- Throws:
InterruptedExceptionExecutionException
-
getSome
public Map<String,T> getSome(long to, TimeUnit unit) throws InterruptedException, ExecutionException Description copied from interface:BulkFutureWait for the operation to complete and return results If operation could not complete within specified timeout, partial result is returned. Otherwise, the behavior is identical toFuture.get(long, TimeUnit)- Specified by:
getSomein interfaceBulkFuture<T>- Parameters:
to-unit-- Returns:
- a partial get bulk result
- Throws:
InterruptedExceptionExecutionException
-
get
public Map<String,T> get(long to, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException - Specified by:
getin interfaceFuture<T>- Throws:
InterruptedExceptionExecutionExceptionTimeoutException
-
internalGet
private Map<String,T> internalGet(long to, TimeUnit unit, Collection<Operation> timedoutOps) throws InterruptedException, ExecutionException refactored code common to both get(long, TimeUnit) and getSome(long, TimeUnit).- Parameters:
to-unit-timedoutOps-- Returns:
- Throws:
InterruptedExceptionExecutionException
-
getStatus
Description copied from interface:BulkFutureGets the status of the operation upon completion.- Specified by:
getStatusin interfaceBulkFuture<T>- Returns:
- the operation status.
-
setStatus
-
isCancelled
public boolean isCancelled()- Specified by:
isCancelledin interfaceFuture<T>
-
isDone
-
isTimeout
public boolean isTimeout()- Specified by:
isTimeoutin interfaceBulkFuture<T>- Returns:
- true if timeout was reached, false otherwise
-
addListener
Description copied from interface:ListenableFutureAdd a listener to the future, which will be executed once the operation completes.- Specified by:
addListenerin interfaceBulkFuture<T>- Specified by:
addListenerin interfaceListenableFuture<Map<String,T>, BulkGetCompletionListener> - Parameters:
listener- the listener which will be executed.- Returns:
- the current future to allow for object-chaining.
-
removeListener
Description copied from interface:ListenableFutureRemove a previously added listener from the future.- Specified by:
removeListenerin interfaceBulkFuture<T>- Specified by:
removeListenerin interfaceListenableFuture<Map<String,T>, BulkGetCompletionListener> - 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.
-