Package com.oracle.coherence.grpc.proxy
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 toDefaultCacheServerlifecycle events.- Author:
- Jonathan Knight 2020.09.24
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classGrpcServerController.ListenerA listener that will start the gRPC server base onCoherenceorDefaultCacheServerlifecycle events.
-
Field Summary
Fields Modifier and Type Field Description static GrpcServerControllerINSTANCEThe singleton instance of theGrpcServerController.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description List<BindableGrpcProxyService>createGrpcServices()Deprecated.StringgetInProcessName()Returns the name of the in-process gRPC server.intgetPort()Returns the port that the gRPC server has bound to.booleanisRunning()Returnstrueif the server is running.voidmarkStarted()Mark the server as started.voidsetEnabled(boolean fEnabled)Enable or disable this controller.voidstart()Start the gRPC server.voidstop()Stop the server.CompletionStage<Void>whenStarted()Obtain aCompletionStagethat will be completed when the gRPC server has started.
-
-
-
Field Detail
-
INSTANCE
public static final GrpcServerController INSTANCE
The singleton instance of theGrpcServerController.
-
-
Method Detail
-
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
CompletionStageif not already completed.
-
whenStarted
public CompletionStage<Void> whenStarted()
Obtain aCompletionStagethat will be completed when the gRPC server has started.- Returns:
- a
CompletionStagethat will be completed when the gRPC server has started
-
isRunning
public boolean isRunning()
Returnstrueif the server is running.- Returns:
trueif 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
-
createGrpcServices
@Deprecated(since="22.06.2") public List<BindableGrpcProxyService> createGrpcServices()
Deprecated.Obtain the list of gRPC proxy services to bind to a gRPC server.- Returns:
- the list of gRPC proxy services to bind to a gRPC server
-
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-falseto disable the controller.
-
-