Interface NexusOperationHandle<R>

Type Parameters:
R - the result type of the Nexus operation
All Superinterfaces:
UntypedNexusOperationHandle

@Experimental public interface NexusOperationHandle<R> extends UntypedNexusOperationHandle
A typed handle to a standalone Nexus operation execution. Extends UntypedNexusOperationHandle with typed result methods bound to a known result type.

Obtain an instance via NexusServiceClient or by wrapping an UntypedNexusOperationHandle (returned by NexusClient.getHandle(String, String)) with fromUntyped(UntypedNexusOperationHandle, Class).

See Also:
  • Method Details

    • fromUntyped

      static <R> NexusOperationHandle<R> fromUntyped(UntypedNexusOperationHandle handle, Class<R> resultClass)
      Wraps an UntypedNexusOperationHandle with a known result type.
      Parameters:
      handle - the untyped handle to wrap
      resultClass - the class to deserialize the result into
      Returns:
      a typed handle
    • fromUntyped

      static <R> NexusOperationHandle<R> fromUntyped(UntypedNexusOperationHandle handle, Class<R> resultClass, @Nullable Type resultType)
      Wraps an UntypedNexusOperationHandle with a known result type for generic types. Pass a non-null resultType when the result is a generic type whose parameters cannot be captured by Class alone (e.g. List<String>).
      Parameters:
      handle - the untyped handle to wrap
      resultClass - the class to deserialize the result into
      resultType - the generic type; may be null
      Returns:
      a typed handle
    • getResult

      R getResult()
      Blocks until the Nexus operation completes and returns the typed result.
      Throws:
      NexusOperationException - if the operation failed, timed out, or was cancelled
    • getResult

      R getResult(long timeout, TimeUnit unit) throws TimeoutException
      Blocks until the Nexus operation completes and returns the typed result, or throws if the client-side timeout expires first.
      Parameters:
      timeout - maximum time to wait
      unit - unit of timeout
      Throws:
      NexusOperationException - if the operation failed, timed out on the server, or was cancelled
      TimeoutException - if timeout expires before the operation completes
    • getResultAsync

      CompletableFuture<R> getResultAsync()
      Returns a future that completes when the Nexus operation completes with the typed result.
    • getResultAsync

      CompletableFuture<R> getResultAsync(long timeout, TimeUnit unit)
      Returns a future that completes with the typed result, or completes exceptionally with a TimeoutException if timeout elapses before the operation completes.
      Parameters:
      timeout - maximum time to wait
      unit - unit of timeout