M
- metadata typeT
- result type.public final class AsyncOperationResult<M,T>
extends java.lang.Object
AsyncOperationResult
represents a completion of an asynchronous operation, registered
by a stateful function instance via a Context.registerAsyncOperation(Object,
CompletableFuture)
.
The status of the asynchronous operation can be obtain via status()
, and it can be
one of:
success
- The asynchronous operation has succeeded, and the produced result can be
obtained via value()
.
failure
- The asynchronous operation has failed, and the cause can be obtained via
(throwable()
.
unknown
- the stateful function was restarted, possibly on a different machine,
before the CompletableFuture
was completed, therefore it is unknown what is the
status of the asynchronous operation.
Modifier and Type | Class and Description |
---|---|
static class |
AsyncOperationResult.Status |
Constructor and Description |
---|
AsyncOperationResult(M metadata,
AsyncOperationResult.Status status,
T value,
java.lang.Throwable throwable) |
Modifier and Type | Method and Description |
---|---|
boolean |
failure() |
M |
metadata() |
AsyncOperationResult.Status |
status() |
boolean |
successful() |
java.lang.Throwable |
throwable() |
boolean |
unknown() |
T |
value() |
@ForRuntime public AsyncOperationResult(M metadata, AsyncOperationResult.Status status, T value, java.lang.Throwable throwable)
public M metadata()
Context.registerAsyncOperation(Object, CompletableFuture)
.public AsyncOperationResult.Status status()
public T value()
public java.lang.Throwable throwable()
public boolean successful()
public boolean unknown()
public boolean failure()
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.