|
bool | isDone () const |
| Returns true when a computation has completed normally, or exceptionally, or was canceled.
|
|
bool | hasResult () const |
| Returns true when computation has completed normally.
|
|
bool | hasException () const |
| Returns true when a computation has completed exceptionally or was canceled.
|
|
bool | isCancelled () const |
| Returns true when computation was cancelled.
|
|
JavaException | getException () const |
| Returns exceptional outcome of computation.
|
|
bool | awaitWithoutException (std::int32_t timeoutInMilliseconds) const |
| Wait for computation to complete or timeout or throw an exception in case of exceptional completion.
|
|
bool | awaitWithoutException (const std::chrono::milliseconds &timeoutInMilliseconds) const |
| Wait for computation to complete or timeout or throw an exception in case of exceptional completion.
|
|
void | cancel () const |
| This method cancels computation.
|
|
template<typename P>
struct CommonPromiseMixin< P >
Mixin for wrapping calls to common promise methods.
- Template Parameters
-
template<typename P>
bool CommonPromiseMixin< P >::awaitWithoutException |
( |
const std::chrono::milliseconds & | timeoutInMilliseconds | ) |
const |
|
inline |
Wait for computation to complete or timeout or throw an exception in case of exceptional completion.
If the wait is interrupted, then the computation is canceled, the interruption flag on the current thread is set, and "CancellationException" is thrown.
If the wait times are out, then the computation is canceled and this method returns false
. Use this method in the code that shall continue normal execution in case of timeout.
- Parameters
-
timeoutInMilliseconds | The timeout. |
- Returns
true
if the computation has completed normally; false
when wait timed out.
- Exceptions
-
CancellationException | if computation was cancelled. |
PromiseException | if computation has completed exceptionally. |
template<typename P>
bool CommonPromiseMixin< P >::awaitWithoutException |
( |
std::int32_t | timeoutInMilliseconds | ) |
const |
|
inline |
Wait for computation to complete or timeout or throw an exception in case of exceptional completion.
If the wait is interrupted, then the computation is canceled, the interruption flag on the current thread is set, and "CancellationException" is thrown.
If the wait times are out, then the computation is canceled and this method returns false
. Use this method in the code that shall continue normal execution in case of timeout.
- Parameters
-
timeoutInMilliseconds | The timeout. |
- Returns
true
if the computation has completed normally; false
when wait timed out.
- Exceptions
-
CancellationException | if computation was cancelled. |
PromiseException | if computation has completed exceptionally. |
This method cancels computation.
This method does nothing if the computation has already completed.
If cancelled, then getException() will return "CancellationException", isDone, isCancelled, and hasException will return true
, all handlers that were installed with whenDone
method are notified by invoking their promiseDone
method, and all waiters on join method throw "CancellationException".