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 toDefaultCacheServer
lifecycle events.- Author:
- Jonathan Knight 2020.09.24
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
GrpcServerController.Listener
A listener that will start the gRPC server base onCoherence
orDefaultCacheServer
lifecycle events.
-
Field Summary
Fields Modifier and Type Field Description static GrpcServerController
INSTANCE
The singleton instance of theGrpcServerController
.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description List<BindableGrpcProxyService>
createGrpcServices()
Deprecated.String
getInProcessName()
Returns the name of the in-process gRPC server.int
getPort()
Returns the port that the gRPC server has bound to.boolean
isRunning()
Returnstrue
if the server is running.void
markStarted()
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.CompletionStage<Void>
whenStarted()
Obtain aCompletionStage
that 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
CompletionStage
if not already completed.
-
whenStarted
public CompletionStage<Void> 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
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
-false
to disable the controller.
-
-