
public class WaarpFuture extends Object implements WaarpFutureInterface
| Constructor and Description |
|---|
WaarpFuture()
Creates a new instance.
|
WaarpFuture(boolean cancellable)
Creates a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
awaitOrInterruptible() |
boolean |
awaitOrInterruptible(long timeoutMilliseconds) |
boolean |
awaitOrInterruptible(long timeout,
TimeUnit unit) |
boolean |
cancel()
Cancels the operation associated with this future and notifies all
listeners if canceled successfully.
|
Throwable |
getCause()
Returns the cause of the failed operation if the operation has failed.
|
boolean |
isCancelled()
Returns
true if and only if this future was canceled by a cancel() method. |
boolean |
isDone()
Returns
true if and only if this future is complete, regardless
of
whether the operation was
successful, failed, or canceled. |
boolean |
isFailed()
Returns
true if and only if the operation was completed but
unsuccessfully. |
boolean |
isSuccess()
Returns
true if and only if the operation was completed
successfully. |
void |
reset()
Experimental: try to re-enable the future
|
WaarpFuture |
rethrowIfFailed()
Rethrows the exception that caused this future fail if this future is
complete and failed.
|
boolean |
setFailure(Throwable cause)
Marks this future as a failure and notifies all listeners.
|
boolean |
setSuccess()
Marks this future as a success and notifies all listeners.
|
public WaarpFuture()
public WaarpFuture(boolean cancellable)
cancellable - true if and only if this future can be
canceledpublic final boolean isDone()
true if and only if this future is complete, regardless
of
whether the operation was
successful, failed, or canceled.isDone in interface WaarpFutureInterfacepublic final boolean isSuccess()
true if and only if the operation was completed
successfully.isSuccess in interface WaarpFutureInterfacepublic final boolean isFailed()
true if and only if the operation was completed but
unsuccessfully.isFailed in interface WaarpFutureInterfacepublic final Throwable getCause()
getCause in interface WaarpFutureInterfacenull if succeeded or this
future
is not completed yet.public final boolean isCancelled()
true if and only if this future was canceled by a cancel() method.isCancelled in interface WaarpFutureInterfacepublic final WaarpFuture rethrowIfFailed() throws Exception
rethrowIfFailed in interface WaarpFutureInterfaceExceptionpublic final boolean awaitOrInterruptible()
awaitOrInterruptible in interface WaarpFutureInterfacepublic final boolean awaitOrInterruptible(long timeoutMilliseconds)
awaitOrInterruptible in interface WaarpFutureInterfacetimeoutMilliseconds - public final boolean awaitOrInterruptible(long timeout,
TimeUnit unit)
awaitOrInterruptible in interface WaarpFutureInterfacetimeout - unit - public final boolean setSuccess()
setSuccess in interface WaarpFutureInterfacetrue if and only if successfully marked this future as a
success. Otherwise false
because this future is already marked as either a success or a
failure.public final boolean setFailure(Throwable cause)
setFailure in interface WaarpFutureInterfacecause - true if and only if successfully marked this future as a
failure. Otherwise false
because this future is already marked as either a success or a
failure.public final boolean cancel()
cancel in interface WaarpFutureInterfacetrue if and only if the operation has been canceled.
false if the operation can't
be canceled or is already completed.public final void reset()
reset in interface WaarpFutureInterfaceCopyright © 2009–2022 Waarp. All rights reserved.