Class NexusOperationHandleImpl
java.lang.Object
io.temporal.internal.client.NexusOperationHandleImpl
- All Implemented Interfaces:
UntypedNexusOperationHandle
Implementation of
UntypedNexusOperationHandle that delegates lifecycle operations through
the interceptor chain.-
Constructor Summary
ConstructorsConstructorDescriptionNexusOperationHandleImpl(String operationId, String runId, NexusClientCallsInterceptor interceptor) -
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.
-
Constructor Details
-
NexusOperationHandleImpl
public NexusOperationHandleImpl(String operationId, @Nullable String runId, NexusClientCallsInterceptor interceptor)
-
-
Method Details
-
getNexusOperationId
Description copied from interface:UntypedNexusOperationHandleThe caller-assigned operation ID for this execution. Always non-null.- Specified by:
getNexusOperationIdin interfaceUntypedNexusOperationHandle
-
getNexusOperationRunId
Description copied from interface:UntypedNexusOperationHandleThe 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.- Specified by:
getNexusOperationRunIdin interfaceUntypedNexusOperationHandle
-
describe
Description copied from interface:UntypedNexusOperationHandleDescribes the current state of the Nexus operation execution.- Specified by:
describein interfaceUntypedNexusOperationHandle- Returns:
- detailed information about the operation
-
cancel
public void cancel()Description copied from interface:UntypedNexusOperationHandleRequests cancellation of the Nexus operation.- Specified by:
cancelin interfaceUntypedNexusOperationHandle
-
cancel
Description copied from interface:UntypedNexusOperationHandleRequests cancellation of the Nexus operation with an optional reason.- Specified by:
cancelin interfaceUntypedNexusOperationHandle- Parameters:
reason- human-readable reason for cancellation, may benull
-
terminate
public void terminate()Description copied from interface:UntypedNexusOperationHandleTerminates the Nexus operation immediately, regardless of its current state.- Specified by:
terminatein interfaceUntypedNexusOperationHandle
-
terminate
Description copied from interface:UntypedNexusOperationHandleTerminates the Nexus operation immediately with a reason.- Specified by:
terminatein interfaceUntypedNexusOperationHandle- Parameters:
reason- human-readable reason for termination, may benull
-
getResult
Description copied from interface:UntypedNexusOperationHandleBlocks until the standalone Nexus operation completes and returns the typed result. Polls the server via long-polling.- Specified by:
getResultin interfaceUntypedNexusOperationHandle- Parameters:
resultClass- the class to deserialize the result into
-
getResult
Description copied from interface:UntypedNexusOperationHandleBlocks until the standalone Nexus operation completes and returns the typed result. Use this overload for generic return types (e.g.List<String>).- Specified by:
getResultin interfaceUntypedNexusOperationHandle- Parameters:
resultClass- the class to deserialize the result intoresultType- the generic type to use for deserialization; may benull
-
getResultAsync
Description copied from interface:UntypedNexusOperationHandleReturns a future that completes when the operation completes and resolves to the typed result.- Specified by:
getResultAsyncin interfaceUntypedNexusOperationHandle- Parameters:
resultClass- the class to deserialize the result into
-
getResultAsync
Description copied from interface:UntypedNexusOperationHandleReturns 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>).- Specified by:
getResultAsyncin interfaceUntypedNexusOperationHandle- Parameters:
resultClass- the class to deserialize the result intoresultType- the generic type to use for deserialization; may benull
-
getResult
Description copied from interface:UntypedNexusOperationHandleBlocks until the standalone Nexus operation completes and returns the typed result, or throws if the client-side timeout expires before the operation completes.- Specified by:
getResultin interfaceUntypedNexusOperationHandle- Parameters:
timeout- maximum time to waitunit- unit oftimeoutresultClass- the class to deserialize the result into- Throws:
TimeoutException- if the client-sidetimeoutexpires before the operation completes
-
getResult
public <R> R getResult(long timeout, TimeUnit unit, Class<R> resultClass, @Nullable Type resultType) throws TimeoutException Description copied from interface:UntypedNexusOperationHandleBlocks 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>).- Specified by:
getResultin interfaceUntypedNexusOperationHandle- 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:
TimeoutException- if the client-sidetimeoutexpires before the operation completes
-
getResultAsync
Description copied from interface:UntypedNexusOperationHandleReturns a future that completes when the operation completes, or fails withTimeoutExceptionif the operation does not complete within the specified timeout.- Specified by:
getResultAsyncin interfaceUntypedNexusOperationHandle- Parameters:
timeout- maximum time to waitunit- unit oftimeoutresultClass- the class to deserialize the result into
-
getResultAsync
public <R> CompletableFuture<R> getResultAsync(long timeout, TimeUnit unit, Class<R> resultClass, @Nullable Type resultType) Description copied from interface:UntypedNexusOperationHandleReturns a future for generic return types with a timeout.- Specified by:
getResultAsyncin interfaceUntypedNexusOperationHandle- Parameters:
timeout- maximum time to waitunit- unit oftimeoutresultClass- the class to deserialize the result intoresultType- the generic type to use for deserialization; may benull
-