Interface NettyEmbeddedServer
- All Superinterfaces:
ApplicationContextLifeCycle<EmbeddedServer>, ApplicationContextProvider, ApplicationEventListener<RefreshEvent>, AutoCloseable, ChannelPipelineCustomizer, Closeable, EmbeddedApplication<EmbeddedServer>, EmbeddedServer, EventListener, GracefulShutdownCapable, LifeCycle<EmbeddedServer>, NettyServerCustomizer.Registry, Ordered, RefreshEventListener, WebSocketSessionRepository
- All Known Implementing Classes:
NettyHttpServer
public interface NettyEmbeddedServer
extends EmbeddedServer, WebSocketSessionRepository, ChannelPipelineCustomizer, RefreshEventListener, NettyServerCustomizer.Registry, GracefulShutdownCapable
Extended
EmbeddedServer interface that represents a
Netty-based HTTP server.- Since:
- 3.1.0
- Author:
- graemerocher
-
Field Summary
Fields inherited from interface ChannelPipelineCustomizer
HANDLER_ACCESS_LOGGER, HANDLER_ACTIVITY_LISTENER, HANDLER_CONNECT_TTL, HANDLER_FLOW_CONTROL, HANDLER_HTTP_AGGREGATOR, HANDLER_HTTP_CHUNK, HANDLER_HTTP_CLIENT_CODEC, HANDLER_HTTP_CLIENT_INIT, HANDLER_HTTP_COMPRESSOR, HANDLER_HTTP_DECODER, HANDLER_HTTP_DECOMPRESSOR, HANDLER_HTTP_KEEP_ALIVE, HANDLER_HTTP_PROXY, HANDLER_HTTP_SERVER_CODEC, HANDLER_HTTP_STREAM, HANDLER_HTTP_TO_HTTPS_REDIRECT, HANDLER_HTTP2_CONNECTION, HANDLER_HTTP2_PING_SENDER, HANDLER_HTTP2_PROTOCOL_NEGOTIATOR, HANDLER_HTTP2_SETTINGS, HANDLER_HTTP2_UPGRADE_REQUEST, HANDLER_IDLE_STATE, HANDLER_INITIAL_ERROR, HANDLER_MICRONAUT_FULL_HTTP_RESPONSE, HANDLER_MICRONAUT_HTTP_RESPONSE, HANDLER_MICRONAUT_HTTP_RESPONSE_FULL, HANDLER_MICRONAUT_HTTP_RESPONSE_STREAM, HANDLER_MICRONAUT_INBOUND, HANDLER_MICRONAUT_SSE_CONTENT, HANDLER_MICRONAUT_SSE_EVENT_STREAM, HANDLER_MICRONAUT_WEBSOCKET_CLIENT, HANDLER_READ_TIMEOUT, HANDLER_SOCKS_5_PROXY, HANDLER_SSL, HANDLER_WEBSOCKET_UPGRADEFields inherited from interface Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCEFields inherited from interface RefreshEventListener
DEFAULT_POSITION -
Method Summary
Modifier and TypeMethodDescriptionGets the set of all ports this Netty server is bound to.default voidregister(NettyServerCustomizer customizer) Register a new customizer with this server.default CompletionStage<?> Trigger a graceful shutdown.default NettyEmbeddedServerstart()Starts the lifecyle component.default NettyEmbeddedServerstop()Stops the life cycle component.Stops the Netty instance, but keeps the ApplicationContext running.Methods inherited from interface ApplicationEventListener
onApplicationEventMethods inherited from interface ChannelPipelineCustomizer
doOnConnect, isClientChannel, isServerChannelMethods inherited from interface EmbeddedApplication
getApplicationConfiguration, getApplicationContext, getEnvironment, isForceExit, isShutdownHookNeededMethods inherited from interface EmbeddedServer
getContextURI, getHost, getPort, getScheme, getURI, getURL, isKeepAlive, isServerMethods inherited from interface GracefulShutdownCapable
reportActiveTasksMethods inherited from interface RefreshEventListener
getObservedConfigurationPrefixes, getOrder, supportsMethods inherited from interface WebSocketSessionRepository
addChannel, getChannelGroup, removeChannel
-
Method Details
-
getBoundPorts
-
start
Description copied from interface:LifeCycleStarts the lifecyle component.- Specified by:
startin interfaceApplicationContextLifeCycle<EmbeddedServer>- Specified by:
startin interfaceLifeCycle<EmbeddedServer>- Returns:
- This lifecycle component
-
stop
Description copied from interface:LifeCycleStops the life cycle component.- Specified by:
stopin interfaceApplicationContextLifeCycle<EmbeddedServer>- Specified by:
stopin interfaceLifeCycle<EmbeddedServer>- Returns:
- This lifecycle component
-
stopServerOnly
NettyEmbeddedServer stopServerOnly()Stops the Netty instance, but keeps the ApplicationContext running. This for CRaC checkpointing purposes. This method will only return after waiting for netty to stop.- Returns:
- The stopped NettyEmbeddedServer
-
register
Description copied from interface:NettyServerCustomizer.RegistryRegister a new customizer with this server. Note that this method must be called before the server is started: When a listener launches, it may only respect the customizers that were registered at the time, and ignore future additions.- Specified by:
registerin interfaceNettyServerCustomizer.Registry- Parameters:
customizer- The customizer to register.
-
shutdownGracefully
Description copied from interface:GracefulShutdownCapableTrigger a graceful shutdown. The returnedCompletionStagewill complete when the shutdown is complete.Note that the completion of the returned future may be user-dependent. If a user does not close their connection, the future may never terminate. Always add a timeout for a hard shutdown.
This method should not throw an exception, nor should the returned stage complete exceptionally. Just log an error instead.
- Specified by:
shutdownGracefullyin interfaceGracefulShutdownCapable- Returns:
- A future that completes when this bean is fully shut down
-