public interface WebServer
started
and stopped
.Modifier and Type | Method and Description |
---|---|
int |
getPort()
Return the port this server is listening on.
|
default void |
shutDownGracefully(GracefulShutdownCallback callback)
Initiates a graceful shutdown of the web server.
|
void |
start()
Starts the web server.
|
void |
stop()
Stops the web server.
|
void start() throws WebServerException
WebServerException
- if the server cannot be startedvoid stop() throws WebServerException
WebServerException
- if the server cannot be stoppedint getPort()
default void shutDownGracefully(GracefulShutdownCallback callback)
callback
is invoked at the end of the attempt. The
attempt can be explicitly ended by invoking stop()
. The default
implementation invokes the callback immediately with
GracefulShutdownResult.IMMEDIATE
, i.e. no attempt is made at a graceful
shutdown.callback
- the callback to invoke when the graceful shutdown completes