Package com.facebook.openwifi.rrm
Class CustomJettyServerFactory
- java.lang.Object
-
- com.facebook.openwifi.rrm.CustomJettyServerFactory
-
- All Implemented Interfaces:
spark.embeddedserver.jetty.JettyServerFactory
public class CustomJettyServerFactory extends Object implements spark.embeddedserver.jetty.JettyServerFactory
Creates Jetty Server instances. Majority of the logic is taken from JettyServerFactory. The additional feature is that this class will actually set two connectors (original class doesn't set any connectors at all and leaves it up to the serivce start logic). Since we set two connectors here on the server, Spark uses the existing conectors instead of trying to spin up its own connectors. The other difference is that it uses a different ServerConnector constructor to avoid allocating additional threads that aren't necessary (makeConnector(org.eclipse.jetty.server.Server, java.lang.String, int, boolean))- See Also:
EmbeddedJettyFactory
-
-
Constructor Summary
Constructors Constructor Description CustomJettyServerFactory(int internalPort, int externalPort)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.eclipse.jetty.server.Servercreate(int maxThreads, int minThreads, int threadTimeoutMillis)Creates a Jetty server.org.eclipse.jetty.server.Servercreate(org.eclipse.jetty.util.thread.ThreadPool threadPool)Creates a Jetty server with supplied thread poolorg.eclipse.jetty.server.ConnectormakeConnector(org.eclipse.jetty.server.Server server, String host, int port, boolean trustForwardHeaders)This is basically spark.embeddedserver.jetty.SocketConnectorFactory.createSocketConnector, the only difference being that we use a different constructor for the Connector and that the private methods called are just inlined.voidsetTrustForwardHeaders(boolean trustForwardHeaders)
-
-
-
Method Detail
-
setTrustForwardHeaders
public void setTrustForwardHeaders(boolean trustForwardHeaders)
-
makeConnector
public org.eclipse.jetty.server.Connector makeConnector(org.eclipse.jetty.server.Server server, String host, int port, boolean trustForwardHeaders)This is basically spark.embeddedserver.jetty.SocketConnectorFactory.createSocketConnector, the only difference being that we use a different constructor for the Connector and that the private methods called are just inlined.
-
create
public org.eclipse.jetty.server.Server create(int maxThreads, int minThreads, int threadTimeoutMillis)Creates a Jetty server.- Specified by:
createin interfacespark.embeddedserver.jetty.JettyServerFactory- Parameters:
maxThreads- maxThreadsminThreads- minThreadsthreadTimeoutMillis- threadTimeoutMillis- Returns:
- a new jetty server instance
-
create
public org.eclipse.jetty.server.Server create(org.eclipse.jetty.util.thread.ThreadPool threadPool)
Creates a Jetty server with supplied thread pool- Specified by:
createin interfacespark.embeddedserver.jetty.JettyServerFactory- Parameters:
threadPool- thread pool- Returns:
- a new jetty server instance
-
-