Interface UntypedNexusOperationHandle
- All Known Subinterfaces:
NexusOperationHandle<R>
- All Known Implementing Classes:
NexusOperationHandleImpl
An untyped handle to a standalone Nexus operation execution. Use this to get the result,
describe, cancel, or terminate the operation when the result type is not known at compile time.
Obtain an instance via NexusClient.getHandle(String, String) or as the untyped
projection of a handle returned by NexusServiceClient.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoidcancel()Requests cancellation of the Nexus operation.voidRequests cancellation of the Nexus operation with an optional reason.describe()Describes the current state of the Nexus operation execution.The caller-assigned operation ID for this execution.The server-assigned run ID for this operation execution.<R> RBlocks until the standalone Nexus operation completes and returns the typed result, or throws if the client-side timeout expires before the operation completes.<R> RBlocks until the standalone Nexus operation completes and returns the typed result, or throws if the client-side timeout expires.<R> RBlocks until the standalone Nexus operation completes and returns the typed result.<R> RBlocks until the standalone Nexus operation completes and returns the typed result.<R> CompletableFuture<R> getResultAsync(long timeout, TimeUnit unit, Class<R> resultClass) Returns a future that completes when the operation completes, or fails withTimeoutExceptionif the operation does not complete within the specified timeout.<R> CompletableFuture<R> getResultAsync(long timeout, TimeUnit unit, Class<R> resultClass, Type resultType) Returns a future for generic return types with a timeout.<R> CompletableFuture<R> getResultAsync(Class<R> resultClass) Returns a future that completes when the operation completes and resolves to the typed result.<R> CompletableFuture<R> getResultAsync(Class<R> resultClass, Type resultType) Returns a future that completes when the operation completes and resolves to the typed result.voidTerminates the Nexus operation immediately, regardless of its current state.voidTerminates the Nexus operation immediately with a reason.
-
Method Details
-
getNexusOperationId
String getNexusOperationId()The caller-assigned operation ID for this execution. Always non-null. -
getNexusOperationRunId
The server-assigned run ID for this operation execution. Present when the handle was returned bystartor whenNexusClient.getHandle(String, String)was called with an explicit run ID. -
getResult
Blocks until the standalone Nexus operation completes and returns the typed result. Polls the server via long-polling.- Parameters:
resultClass- the class to deserialize the result into- Throws:
NexusOperationException- if the operation failed, timed out, or was cancelled; the concrete subtype reflects the underlying failure
-
getResult
Blocks until the standalone Nexus operation completes and returns the typed result. Use this overload for generic return types (e.g.List<String>).- Parameters:
resultClass- the class to deserialize the result intoresultType- the generic type to use for deserialization; may benull- Throws:
NexusOperationException- if the operation failed, timed out, or was cancelled; the concrete subtype reflects the underlying failure
-
getResult
Blocks until the standalone Nexus operation completes and returns the typed result, or throws if the client-side timeout expires before the operation completes.- Parameters:
timeout- maximum time to waitunit- unit oftimeoutresultClass- the class to deserialize the result into- Throws:
NexusOperationException- if the operation failed, timed out on the server, or was cancelledTimeoutException- if the client-sidetimeoutexpires before the operation completes
-
getResult
<R> R getResult(long timeout, TimeUnit unit, Class<R> resultClass, @Nullable Type resultType) throws TimeoutException Blocks until the standalone Nexus operation completes and returns the typed result, or throws if the client-side timeout expires. Use this overload for generic return types (e.g.List<String>).- Parameters:
timeout- maximum time to waitunit- unit oftimeoutresultClass- the class to deserialize the result intoresultType- the generic type to use for deserialization; may benull- Throws:
NexusOperationException- if the operation failed, timed out on the server, or was cancelledTimeoutException- if the client-sidetimeoutexpires before the operation completes
-
getResultAsync
Returns a future that completes when the operation completes and resolves to the typed result.- Parameters:
resultClass- the class to deserialize the result into
-
getResultAsync
Returns a future that completes when the operation completes and resolves to the typed result. Use this overload for generic return types (e.g.List<String>).- Parameters:
resultClass- the class to deserialize the result intoresultType- the generic type to use for deserialization; may benull
-
getResultAsync
Returns a future that completes when the operation completes, or fails withTimeoutExceptionif the operation does not complete within the specified timeout.- Parameters:
timeout- maximum time to waitunit- unit oftimeoutresultClass- the class to deserialize the result into
-
getResultAsync
<R> CompletableFuture<R> getResultAsync(long timeout, TimeUnit unit, Class<R> resultClass, @Nullable Type resultType) Returns a future for generic return types with a timeout.- Parameters:
timeout- maximum time to waitunit- unit oftimeoutresultClass- the class to deserialize the result intoresultType- the generic type to use for deserialization; may benull
-
describe
NexusOperationExecutionDescription describe()Describes the current state of the Nexus operation execution.- Returns:
- detailed information about the operation
-
cancel
void cancel()Requests cancellation of the Nexus operation. -
cancel
Requests cancellation of the Nexus operation with an optional reason.- Parameters:
reason- human-readable reason for cancellation, may benull
-
terminate
void terminate()Terminates the Nexus operation immediately, regardless of its current state. -
terminate
Terminates the Nexus operation immediately with a reason.- Parameters:
reason- human-readable reason for termination, may benull
-