Class ServerConnector

java.lang.Object
All Implemented Interfaces:
Closeable, AutoCloseable, Connector, NetworkConnector, Container, Destroyable, Dumpable, Dumpable.DumpableContainer, Graceful, LifeCycle
Direct Known Subclasses:
NetworkTrafficServerConnector

@ManagedObject("HTTP connector using NIO ByteChannels and Selectors") public class ServerConnector extends AbstractNetworkConnector
This Connector implementation is the primary connector for the Jetty server over TCP/IP. By the use of various ConnectionFactory instances it is able to accept connections for HTTP, HTTP/2 and WebSocket, either directly or over SSL.

The connector is a fully asynchronous NIO based implementation that by default will use all the commons services (eg Executor, Scheduler) of the passed Server instance, but all services may also be constructor injected into the connector so that it may operate with dedicated or otherwise shared services.

Connection Factories

Various convenience constructors are provided to assist with common configurations of ConnectionFactories, whose generic use is described in AbstractConnector. If no connection factories are passed, then the connector will default to use a HttpConnectionFactory. If an non null SslContextFactory instance is passed, then this used to instantiate a SslConnectionFactory which is prepended to the other passed or default factories.

Selectors

The default number of selectors is equal to half of the number of processors available to the JVM, which should allow optimal performance even if all the connections used are performing significant non-blocking work in the callback tasks.