Interface EmbeddedServer

All Known Implementing Classes:
EmbeddedJettyServer

public interface EmbeddedServer
Represents an embedded server that can be used in Spark. (this is currently Jetty by default).
  • Method Summary

    Modifier and Type
    Method
    Description
    int
     
    default void
    configureWebSockets(Map<String,WebSocketHandlerWrapper> webSocketHandlers, Optional<Integer> webSocketIdleTimeoutMillis)
    Configures the web sockets for the embedded server.
    void
    Extinguish the embedded server.
    int
    ignite(String host, int port, SslStores sslStores, int maxThreads, int minThreads, int threadIdleTimeoutMillis)
    Ignites the embedded server, listening on the specified port, running SSL secured with the specified keystore and truststore.
    void
    Joins the embedded server thread(s).
  • Method Details

    • ignite

      int ignite(String host, int port, SslStores sslStores, int maxThreads, int minThreads, int threadIdleTimeoutMillis) throws Exception
      Ignites the embedded server, listening on the specified port, running SSL secured with the specified keystore and truststore. If truststore is null, keystore is reused.
      Parameters:
      host - The address to listen on
      port - - the port
      sslStores - - The SSL sslStores.
      maxThreads - - max nbr of threads.
      minThreads - - min nbr of threads.
      threadIdleTimeoutMillis - - idle timeout (ms).
      Returns:
      The port number the server was launched on.
      Throws:
      Exception
    • configureWebSockets

      default void configureWebSockets(Map<String,WebSocketHandlerWrapper> webSocketHandlers, Optional<Integer> webSocketIdleTimeoutMillis)
      Configures the web sockets for the embedded server.
      Parameters:
      webSocketHandlers - - web socket handlers.
      webSocketIdleTimeoutMillis - - Optional WebSocket idle timeout (ms).
    • join

      void join() throws InterruptedException
      Joins the embedded server thread(s).
      Throws:
      InterruptedException
    • extinguish

      void extinguish()
      Extinguish the embedded server.
    • activeThreadCount

      int activeThreadCount()
      Returns:
      The approximate number of currently active threads