Class GrpcServerController

java.lang.Object
com.oracle.coherence.grpc.proxy.GrpcServerController

public class GrpcServerController extends Object
A controller class that starts and stops the default gRPC server by responding to DefaultCacheServer lifecycle events.
Author:
Jonathan Knight 2020.09.24
  • Field Details

  • Method Details

    • start

      public void start()
      Start the gRPC server.

      If the server is already running this method is a no-op.

    • stop

      public void stop()
      Stop the server.

      If the server is not running this method is a no-op.

    • markStarted

      public void markStarted()
      Mark the server as started.

      This will complete the start-up CompletionStage if not already completed.

    • whenStarted

      public CompletionStage<Void> whenStarted()
      Obtain a CompletionStage that will be completed when the gRPC server has started.
      Returns:
      a CompletionStage that will be completed when the gRPC server has started
    • isRunning

      public boolean isRunning()
      Returns true if the server is running.
      Returns:
      true if the server is running
    • getPort

      public int getPort()
      Returns the port that the gRPC server has bound to.
      Returns:
      the port that the gRPC server has bound to
      Throws:
      IllegalStateException - if the server is not running
    • getInProcessName

      public String getInProcessName()
      Returns the name of the in-process gRPC server.
      Returns:
      the name of the in-process gRPC server
      Throws:
      IllegalStateException - if the server is not running
    • setEnabled

      public void setEnabled(boolean fEnabled)
      Enable or disable this controller.

      If disabled then the gRPC proxy will not be started. this method can be used in applications where the gRPC services are being deployed manually or by some other mechanism such as CDI.

      Parameters:
      fEnabled - false to disable the controller.