public class GrpcServerLifecycle extends Object implements SmartLifecycle
DEFAULT_PHASE| Constructor and Description |
|---|
GrpcServerLifecycle(GrpcServerFactory factory,
Duration shutdownGracePeriod,
ApplicationEventPublisher eventPublisher)
Creates a new GrpcServerLifecycle
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
createAndStartGrpcServer()
Creates and starts the grpc server.
|
int |
getPhase() |
boolean |
isAutoStartup() |
boolean |
isRunning() |
void |
start() |
void |
stop() |
void |
stop(Runnable callback) |
protected void |
stopAndReleaseGrpcServer()
Initiates an orderly shutdown of the grpc server and releases the references to the server.
|
public GrpcServerLifecycle(GrpcServerFactory factory, Duration shutdownGracePeriod, ApplicationEventPublisher eventPublisher)
factory - The server factory to use.shutdownGracePeriod - The time to wait for the server to gracefully shut down.eventPublisher - The event publisher to use.public void stop(Runnable callback)
stop in interface SmartLifecyclepublic int getPhase()
getPhase in interface PhasedgetPhase in interface SmartLifecyclepublic boolean isAutoStartup()
isAutoStartup in interface SmartLifecycleprotected void createAndStartGrpcServer()
throws IOException
IOException - If the server is unable to bind the port.protected void stopAndReleaseGrpcServer()