public final class FutureCompletion extends com.google.common.util.concurrent.AbstractFuture<Boolean> implements CompletionHandler
This class provides an implementation of CompletionHandler
that allows you to wait for either completed()
or failed(Throwable)
to be called. If failed() was called, the corresponding Throwable will
be rethrown when calling either of the get() methods. Unless an exception is thrown, the get() methods will always
return Boolean.TRUE.
Notice that calling cancel(boolean)
throws an UnsupportedOperationException.
Constructor and Description |
---|
FutureCompletion() |
Modifier and Type | Method and Description |
---|---|
boolean |
cancel(boolean mayInterruptIfRunning) |
void |
completed()
Invoked when an operation has completed.
|
void |
failed(Throwable t)
Invoked when an operation fails.
|
boolean |
isCancelled() |
public void completed()
CompletionHandler
CompletionHandler.failed(Throwable)
to
release the internal Container
reference. Failure to do so will prevent the Container from ever shutting
down.completed
in interface CompletionHandler
public void failed(Throwable t)
CompletionHandler
CompletionHandler.completed()
to release the
internal Container
reference. Failure to do so will prevent the Container from ever shutting down.failed
in interface CompletionHandler
t
- The exception to indicate why the I/O operation failed.public final boolean cancel(boolean mayInterruptIfRunning)
public final boolean isCancelled()
isCancelled
in interface Future<Boolean>
isCancelled
in class com.google.common.util.concurrent.AbstractFuture<Boolean>
Copyright © 2017. All rights reserved.