For example:
//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.
| Modifier and Type | Field and Description |
|---|---|
| private Exception | |
| private boolean | |
| private final Object |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | cancel(boolean
true if the thread
executing this task should be interrupted (if the thread is
known to the implementation); otherwise, in-progress tasks are
allowed to completeImplements java. |
| public Void | Returns: alwaysnullImplements java. |
| public Void | Returns: alwaysnullthe maximum time to wait timeout, TimeUnit the time unit of the timeout argument unit)Implements java. |
| public boolean | Returns: always false.Implements java. |
| public boolean | |
| private void | |
| public void | onCompletion()
Implements javax. |
| public void | onException(Exception
the Exception that occurred e)Implements javax. |
| exception | back to summary |
|---|---|
| private Exception exception | |
| isCompleted | back to summary |
|---|---|
| private boolean isCompleted | |
| lock | back to summary |
|---|---|
| private final Object lock | |
| CompletionListenerFuture | back to summary |
|---|---|
| public CompletionListenerFuture() Constructs a CompletionListenerFuture. | |
| cancel | back to summary |
|---|---|
| public boolean cancel(boolean b) Implements java. Cancelling is not supported, always throws exception.
| |
| get | back to summary |
|---|---|
| public Void get() throws InterruptedException, ExecutionException Implements java. Waits if necessary for the operation to complete. Always returns
| |
| get | back to summary |
|---|---|
| public Void get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException Implements java. Waits if necessary for at most the given time for the operation
to complete. Always returns
| |
| isCancelled | back to summary |
|---|---|
| public boolean isCancelled() Implements java. Cancelling is not supported, always returns false
| |
| isDone | back to summary |
|---|---|
| public boolean isDone() Implements java. Doc from java. Returns
| |
| markAsCompleted | back to summary |
|---|---|
| private void markAsCompleted() Mark operation as completed and wakeup all listeners, called under lock. | |
| onCompletion | back to summary |
|---|---|
| public void onCompletion() throws IllegalStateException Implements javax. Notifies the application that the operation completed successfully.
| |
| onException | back to summary |
|---|---|
| public void onException(Exception e) throws IllegalStateException Implements javax. Notifies the application that the operation failed.
| |