Interface ServiceStubs<B,​F>

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      boolean awaitTermination​(long timeout, java.util.concurrent.TimeUnit unit)
      Awaits for gRPC stubs shutdown up to the specified timeout.
      B blockingStub()  
      void connect​(java.time.Duration timeout)
      Establishes a connection with Temporal Server.
      F futureStub()  
      io.grpc.ManagedChannel getRawChannel()  
      java.util.function.Supplier<io.temporal.api.workflowservice.v1.GetSystemInfoResponse.Capabilities> getServerCapabilities()
      Note: This method is needed mostly for internal SDK purposes only to adjust behavior for different server versions.
      io.grpc.health.v1.HealthCheckResponse healthCheck()
      Checks service health using gRPC standard Health Check: https://github.com/grpc/grpc/blob/master/doc/health-checking.md
      boolean isShutdown()  
      boolean isTerminated()  
      void shutdown()  
      void shutdownNow()  
    • Method Detail

      • blockingStub

        B blockingStub()
        Returns:
        Blocking (synchronous) stub that allows direct calls to service.
      • futureStub

        F futureStub()
        Returns:
        Future (asynchronous) stub that allows direct calls to service.
      • getRawChannel

        io.grpc.ManagedChannel getRawChannel()
        Returns:
        the gRPC channel user by the stubs. This channel may be created internally by the stub or passed to it outside in the Options. This is a "raw" gRPC ManagedChannel, not an intercepted channel.
      • shutdown

        void shutdown()
      • shutdownNow

        void shutdownNow()
      • isShutdown

        boolean isShutdown()
      • isTerminated

        boolean isTerminated()
      • awaitTermination

        boolean awaitTermination​(long timeout,
                                 java.util.concurrent.TimeUnit unit)
        Awaits for gRPC stubs shutdown up to the specified timeout. The shutdown has to be initiated through shutdown() or shutdownNow().

        If waiting thread is interrupted, returns false and sets Thread.interrupted() flag

        Returns:
        false if timed out or the thread was interrupted.
      • connect

        void connect​(@Nullable
                     java.time.Duration timeout)
        Establishes a connection with Temporal Server. If the Server is not available, retries waits for timeout duration.
        Parameters:
        timeout - how long to wait for a successful connection with the server. If null, rpcTimeout configured for this stub will be used.
        Throws:
        io.grpc.StatusRuntimeException - if the server is unavailable after timeout
        java.lang.IllegalStateException - if the channel is already shutdown
      • healthCheck

        io.grpc.health.v1.HealthCheckResponse healthCheck()
        Checks service health using gRPC standard Health Check: https://github.com/grpc/grpc/blob/master/doc/health-checking.md

        ServiceStubsOptions.rpcTimeout is used as a timeout for this call.

        Please note that this method throws if the service Health Check endpoint can't be reached.

        Returns:
        gRPC Health HealthCheckResponse
        Throws:
        io.grpc.StatusRuntimeException - if the service Health Check endpoint is unavailable.
      • getServerCapabilities

        java.util.function.Supplier<io.temporal.api.workflowservice.v1.GetSystemInfoResponse.Capabilities> getServerCapabilities()
        Note: This method is needed mostly for internal SDK purposes only to adjust behavior for different server versions.
        Returns:
        Supplier of Server Capabilities. This method returns a supplier instead of the instance to allow for lazy initialization of the capabilities while eager wiring of the components. This also leaves the flexibility to implement dynamic reloading in the future.