Package spark.embeddedserver
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
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description int
activeThreadCount()
default void
configureWebSockets(java.util.Map<java.lang.String,WebSocketHandlerWrapper> webSocketHandlers, java.util.Optional<java.lang.Integer> webSocketIdleTimeoutMillis)
Configures the web sockets for the embedded server.void
extinguish()
Extinguish the embedded server.int
ignite(java.lang.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
join()
Joins the embedded server thread(s).
-
-
-
Method Detail
-
ignite
int ignite(java.lang.String host, int port, SslStores sslStores, int maxThreads, int minThreads, int threadIdleTimeoutMillis) throws java.lang.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 onport
- - the portsslStores
- - 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:
java.lang.Exception
-
configureWebSockets
default void configureWebSockets(java.util.Map<java.lang.String,WebSocketHandlerWrapper> webSocketHandlers, java.util.Optional<java.lang.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 java.lang.InterruptedException
Joins the embedded server thread(s).- Throws:
java.lang.InterruptedException
-
extinguish
void extinguish()
Extinguish the embedded server.
-
activeThreadCount
int activeThreadCount()
- Returns:
- The approximate number of currently active threads
-
-