Package io.deephaven.server.jetty
Class JettyBackedGrpcServer
java.lang.Object
io.deephaven.server.jetty.JettyBackedGrpcServer
- All Implemented Interfaces:
GrpcServer
-
Constructor Summary
ConstructorsConstructorDescriptionJettyBackedGrpcServer(JettyConfig config, GrpcFilter filter, JsPlugins jsPlugins, ScheduledExecutorService executorService) -
Method Summary
Modifier and TypeMethodDescriptionvoidServer must stop accepting new streams, but let existing streams continue for now.intgetPort()After the server is started, this will return the port it is using.voidjoin()Blocks as long as the server is running, unless this thread is interrupted.voidstart()Starts the server, if possible.voidstopWithTimeout(long timeout, TimeUnit unit) Stops the server, using the specified timeout as a deadline.
-
Constructor Details
-
JettyBackedGrpcServer
@Inject public JettyBackedGrpcServer(JettyConfig config, GrpcFilter filter, JsPlugins jsPlugins, @Named("grpc.server") ScheduledExecutorService executorService)
-
-
Method Details
-
start
Description copied from interface:GrpcServerStarts the server, if possible. Otherwise, throws an exception. If successful, returns.- Specified by:
startin interfaceGrpcServer- Throws:
IOException- if there is an error on startup
-
join
Description copied from interface:GrpcServerBlocks as long as the server is running, unless this thread is interrupted. If stopWithTimeout has been called and the timeout has expired, this will return, and the server will be stopped.- Specified by:
joinin interfaceGrpcServer- Throws:
InterruptedException
-
beginShutdown
public void beginShutdown()Description copied from interface:GrpcServerServer must stop accepting new streams, but let existing streams continue for now.
In theory the listening socket should be freed and available for another application to take it, but this is not rigorously tested.
To complete shutdown, call stopWithTimeout() after any remaining calls have been completed to the server's satisfaction, which will terminate the remaining calls.- Specified by:
beginShutdownin interfaceGrpcServer
-
stopWithTimeout
Description copied from interface:GrpcServerStops the server, using the specified timeout as a deadline. Returns immediately. CallGrpcServer.join()to block until this is completed.
If pending calls do not matter, it is unnecessary to call beginShutdown() before this method.- Specified by:
stopWithTimeoutin interfaceGrpcServer- Parameters:
timeout- time to allow for a graceful shutdown before giving up and haltingunit- unit to apply to the timeout
-
getPort
public int getPort()Description copied from interface:GrpcServerAfter the server is started, this will return the port it is using.- Specified by:
getPortin interfaceGrpcServer- Returns:
- the tcp port that the server is listening on after it has started
-