public class CompletionListenerFuture extends Object implements CompletionListener, Future<Void>
//create a completion future to use to wait for loadAll
CompletionListenerFuture future = new CompletionListenerFuture();
//load the values for the set of keys, replacing those that may already exist in the cache
cache.loadAll(keys, true, future);
//wait for the cache to load the keys
future.get();
A CompletionListenerFuture may only be used once. Attempts to use an instance
multiple times, as part of multiple asynchronous calls will result in an
java.lang.IllegalStateException being raised.Constructor and Description |
---|
CompletionListenerFuture()
Constructs a CompletionListenerFuture.
|
Modifier and Type | Method and Description |
---|---|
boolean |
cancel(boolean b) |
Void |
get() |
Void |
get(long l,
TimeUnit timeUnit) |
boolean |
isCancelled() |
boolean |
isDone() |
void |
onCompletion()
Notifies the application that the operation completed successfully.
|
void |
onException(Exception e)
Notifies the application that the operation failed.
|
public CompletionListenerFuture()
public void onCompletion()
CompletionListener
onCompletion
in interface CompletionListener
public void onException(Exception e)
CompletionListener
onException
in interface CompletionListener
e
- the Exception that occurredpublic boolean isCancelled()
isCancelled
in interface Future<Void>
public Void get() throws InterruptedException, ExecutionException
get
in interface Future<Void>
InterruptedException
ExecutionException
public Void get(long l, TimeUnit timeUnit) throws InterruptedException, ExecutionException, TimeoutException
get
in interface Future<Void>
InterruptedException
ExecutionException
TimeoutException
Copyright © 2013. All Rights Reserved.