Package net.spy.memcached.internal
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 java.util.concurrent.Future
Future.State -
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.booleanbooleanisDone()booleanremoveListener(BulkGetCompletionListener listener) Remove a previously added listener from the future.voidvoidSignals that this future is complete.Methods inherited from class net.spy.memcached.internal.AbstractListenableFuture
addToListeners, executor, notifyListener, notifyListeners, notifyListeners, removeFromListenersMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.concurrent.Future
exceptionNow, resultNow, state
-
Constructor Details
-
BulkGetFuture
public BulkGetFuture(Map<String, Future<T>> m, Collection<Operation> getOps, CountDownLatch l, ExecutorService service)
-
-
Method Details
-
cancel
public boolean cancel(boolean ign) -
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
-
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
public boolean isDone() -
isTimeout
public boolean isTimeout()- Specified by:
isTimeoutin interfaceBulkFuture<T>- Returns:
- true if timeout was reached, false otherwise
-
addListener
Description copied from interface:BulkFutureAdd 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:BulkFutureRemove 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.
-