Interface NettyEmbeddedServer

All Superinterfaces:
ApplicationContextLifeCycle<EmbeddedServer>, ApplicationContextProvider, ApplicationEventListener<RefreshEvent>, AutoCloseable, ChannelPipelineCustomizer, Closeable, EmbeddedApplication<EmbeddedServer>, EmbeddedServer, EventListener, GracefulShutdownCapable, LifeCycle, NettyServerCustomizer.Registry, Ordered, RefreshEventListener, WebSocketSessionRepository
All Known Implementing Classes:
NettyHttpServer

Extended EmbeddedServer interface that represents a Netty-based HTTP server.
Since:
3.1.0
Author:
graemerocher
  • Method Details

    • getBoundPorts

      default Set<Integer> getBoundPorts()
      Gets the set of all ports this Netty server is bound to.
      Returns:
      An immutable set of bound ports if the server has been started with start() an empty set otherwise.
    • start

      Description copied from interface: LifeCycle
      Starts the lifecyle component.
      Specified by:
      start in interface ApplicationContextLifeCycle<EmbeddedServer>
      Specified by:
      start in interface LifeCycle
      Returns:
      This lifecycle component
    • stop

      Description copied from interface: LifeCycle
      Stops the life cycle component.
      Specified by:
      stop in interface ApplicationContextLifeCycle<EmbeddedServer>
      Specified by:
      stop in interface LifeCycle
      Returns:
      This lifecycle component
    • 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

      default void register(@NonNull @NonNull NettyServerCustomizer customizer)
      Description copied from interface: NettyServerCustomizer.Registry
      Register 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:
      register in interface NettyServerCustomizer.Registry
      Parameters:
      customizer - The customizer to register.
    • shutdownGracefully

      default CompletionStage<?> shutdownGracefully()
      Description copied from interface: GracefulShutdownCapable
      Trigger a graceful shutdown. The returned CompletionStage will 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:
      shutdownGracefully in interface GracefulShutdownCapable
      Returns:
      A future that completes when this bean is fully shut down