|
bool | isDone () const |
| Returns true when computation has completed normally, or exceptionally, or was cancelled.
|
|
bool | hasResult () const |
| Returns true when computation has completed normally.
|
|
bool | hasException () const |
| Returns true when computation has completed exceptionally or was cancelled.
|
|
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 |
| 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 cancelled, the interruption flag on the current thread is set, and "CancellationException" is thrown.
If the wait times out, then the computation is cancelled 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 cancelled, the interruption flag on the current thread is set, and "CancellationException" is thrown.
If the wait times out, then the computation is cancelled 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. |