Package com.oracle.coherence.grpc.proxy
Class GrpcServerController
java.lang.Object
com.oracle.coherence.grpc.proxy.GrpcServerController
A controller class that starts and stops the default gRPC server
by responding to
DefaultCacheServer
lifecycle events.- Author:
- Jonathan Knight 2020.09.24
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
A listener that will start the gRPC server base onCoherence
orDefaultCacheServer
lifecycle events. -
Field Summary
Modifier and TypeFieldDescriptionstatic final GrpcServerController
The singleton instance of theGrpcServerController
. -
Method Summary
Modifier and TypeMethodDescriptionReturns the name of the in-process gRPC server.int
getPort()
Returns the port that the gRPC server has bound to.boolean
Returnstrue
if the server is running.void
Mark the server as started.void
setEnabled
(boolean fEnabled) Enable or disable this controller.void
start()
Start the gRPC server.void
stop()
Stop the server.Obtain aCompletionStage
that will be completed when the gRPC server has started.
-
Field Details
-
INSTANCE
The singleton instance of theGrpcServerController
.
-
-
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
Obtain aCompletionStage
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()Returnstrue
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
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.
-