Top Description Inners Fields Constructors Methods
org.eclipse.jetty.server

public Class ServerConnector

extends AbstractNetworkConnector
Class Inheritance
Known Direct Subclasses
org.eclipse.jetty.server.NetworkTrafficServerConnector
Annotations
@ManagedObject:HTTP connector using NIO ByteChannels and Selectors
Imports
java.io.Closeable, .IOException, java.net.InetSocketAddress, .ServerSocket, .Socket, .SocketException, .SocketOption, .StandardSocketOptions, java.nio.channels.Channel, .SelectableChannel, .SelectionKey, .ServerSocketChannel, .SocketChannel, java.util.EventListener, java.util.concurrent.Executor, java.util.concurrent.atomic.AtomicReference, org.eclipse.jetty.io.ByteBufferPool, .Connection, .EndPoint, .ManagedSelector, .SelectorManager, .SocketChannelEndPoint, org.eclipse.jetty.util.IO, org.eclipse.jetty.util.annotation.ManagedAttribute, .ManagedObject, .Name, org.eclipse.jetty.util.ssl.SslContextFactory, org.eclipse.jetty.util.thread.Scheduler

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.

Nested and Inner Type Summary

Modifier and TypeClass and Description
protected class

Field Summary

Modifier and TypeField and Description
private volatile ServerSocketChannel
private volatile int
private volatile int
private volatile boolean
private final AtomicReference<Closeable>
private volatile int
private volatile boolean
private volatile int
private final SelectorManager
private volatile boolean
private volatile boolean

Constructor Summary

AccessConstructor and Description
public
ServerConnector(Server
The Server this connector will accept connection for.
server
)

Construct a ServerConnector with a private instance of HttpConnectionFactory as the only factory.

public
ServerConnector(Server
The Server this connector will accept connection for.
server
,
int
the number of acceptor threads to use, or -1 for a default value. Acceptors accept new TCP/IP connections. If 0, then the selector threads are used to accept connections.
acceptors
,
int
the number of selector threads, or <=0 for a default value. Selectors notice and schedule established connection that can make IO progress.
selectors
)

Construct a ServerConnector with a private instance of HttpConnectionFactory as the only factory.

public
ServerConnector(Server
The Server this connector will accept connection for.
server
,
int
the number of acceptor threads to use, or -1 for a default value. Acceptors accept new TCP/IP connections. If 0, then the selector threads are used to accept connections.
acceptors
,
int
the number of selector threads, or <=0 for a default value. Selectors notice and schedule established connection that can make IO progress.
selectors
,
ConnectionFactory...
Zero or more ConnectionFactory instances used to create and configure connections.
factories
)

Construct a ServerConnector with a private instance of HttpConnectionFactory as the only factory.

public
ServerConnector(Server
The Server this connector will accept connection for.
server
,
ConnectionFactory...
Zero or more ConnectionFactory instances used to create and configure connections.
factories
)

Construct a Server Connector with the passed Connection factories.

public
ServerConnector(Server
The Server this connector will accept connection for.
server
,
SslContextFactory.Server
If non null, then a SslConnectionFactory is instantiated and prepended to the list of HTTP Connection Factory.
sslContextFactory
)

Construct a ServerConnector with a private instance of HttpConnectionFactory as the primary protocol.

public
ServerConnector(Server
The Server this connector will accept connection for.
server
,
int
the number of acceptor threads to use, or -1 for a default value. Acceptors accept new TCP/IP connections. If 0, then the selector threads are used to accept connections.
acceptors
,
int
the number of selector threads, or <=0 for a default value. Selectors notice and schedule established connection that can make IO progress.
selectors
,
SslContextFactory.Server
If non null, then a SslConnectionFactory is instantiated and prepended to the list of HTTP Connection Factory.
sslContextFactory
)

Construct a ServerConnector with a private instance of HttpConnectionFactory as the primary protocol.

public
ServerConnector(Server
The Server this connector will accept connection for.
server
,
SslContextFactory.Server
If non null, then a SslConnectionFactory is instantiated and prepended to the list of ConnectionFactories, with the first factory being the default protocol for the SslConnectionFactory.
sslContextFactory
,
ConnectionFactory...
Zero or more ConnectionFactory instances used to create and configure connections.
factories
)

public
ServerConnector(Server
The server this connector will be accept connection for.
server
,
Executor
An executor used to run tasks for handling requests, acceptors and selectors. If null then use the servers executor
executor
,
Scheduler
A scheduler used to schedule timeouts. If null then use the servers scheduler
scheduler
,
ByteBufferPool
A ByteBuffer pool used to allocate buffers. If null then create a private pool with default configuration.
bufferPool
,
int
the number of acceptor threads to use, or -1 for a default value. Acceptors accept new TCP/IP connections. If 0, then the selector threads are used to accept connections.
acceptors
,
int
the number of selector threads, or <=0 for a default value. Selectors notice and schedule established connection that can make IO progress.
selectors
,
ConnectionFactory...
Zero or more ConnectionFactory instances used to create and configure connections.
factories
)

Method Summary

Modifier and TypeMethod and Description
public void
accept(int acceptorID)

Implements abstract org.eclipse.jetty.server.AbstractConnector.accept.

private void
public void
close()

Overrides org.eclipse.jetty.server.AbstractNetworkConnector.close.

Implements org.eclipse.jetty.server.NetworkConnector.close.

Performs the activities needed to close the network communication (for example, to stop accepting network connections).

protected void
configure(Socket socket)

protected void
doStart()

Overrides org.eclipse.jetty.server.AbstractNetworkConnector.doStart.

Starts the managed lifecycle beans in the order they were added.

protected void
doStop()

Overrides org.eclipse.jetty.server.AbstractNetworkConnector.doStop.

Stops the managed lifecycle beans in the reverse order they were added.

public int
getAcceptedReceiveBufferSize()

Returns: the SO_RCVBUF size to set onto the accepted socket.

public int
getAcceptedSendBufferSize()

Returns: the SO_SNDBUF size to set onto the accepted socket.

public boolean
getAcceptedTcpNoDelay()

Returns: whether the accepted socket gets TCP_NODELAY enabled.

public int
getAcceptQueueSize()

Returns: the accept queue size

public int
public boolean
getReuseAddress()

Returns: whether rebinding the server socket is allowed with sockets in tear-down states

public SelectorManager
public Object
getTransport()

Implements org.eclipse.jetty.server.Connector.getTransport.

Get the underlying socket, channel, buffer etc. for the connector..

public boolean
isInheritChannel()

Returns: whether this connector uses a channel inherited from the JVM.

public boolean
isOpen()

Implements org.eclipse.jetty.server.NetworkConnector.isOpen.

A Connector may be opened and not started (to reserve a port) or closed and running (to allow graceful shutdown of existing connections)

public boolean
isReusePort()

Returns: whether it is allowed to bind multiple server sockets to the same host and port

protected SocketChannelEndPoint
protected SelectorManager
newSelectorManager(Executor executor, Scheduler scheduler, int selectors)

public void
open(ServerSocketChannel
the channel to use
acceptChannel
)

Open the connector using the passed ServerSocketChannel.

public void
open()

Overrides org.eclipse.jetty.server.AbstractNetworkConnector.open.

Implements org.eclipse.jetty.server.NetworkConnector.open.

Performs the activities needed to open the network communication (for example, to start accepting incoming network connections).

protected ServerSocketChannel

Returns:

ServerSocketChannel used to accept connections.
openAcceptChannel
()

Called by open() to obtain the accepting channel.

public void
setAcceptedReceiveBufferSize(int
the SO_RCVBUF size to set onto the accepted socket. A value of -1 indicates that it is left to its default value.
receiveBufferSize
)

public void
setAcceptedSendBufferSize(int
the SO_SNDBUF size to set onto the accepted socket. A value of -1 indicates that it is left to its default value.
sendBufferSize
)

public void
setAcceptedTcpNoDelay(boolean
whether TCP_NODELAY gets enabled on the the accepted socket.
tcpNoDelay
)

public void
public void
setAcceptQueueSize(int
the accept queue size (also known as accept backlog)
acceptQueueSize
)

Set the accept queue size (also known as accept backlog).

public void
setInheritChannel(boolean
whether this connector uses a channel inherited from the JVM.
inheritChannel
)

Sets whether this connector uses a channel inherited from the JVM.

public void
setReuseAddress(boolean
whether rebinding the server socket is allowed with sockets in tear-down states
reuseAddress
)

public void
setReusePort(boolean
whether it is allowed to bind multiple server sockets to the same host and port
reusePort
)

Set whether it is allowed to bind multiple server sockets to the same host and port.

private <T> void
setSocketOption(ServerSocketChannel channel, SocketOption<T> option, T value)

Inherited from org.eclipse.jetty.server.AbstractNetworkConnector:
getHostgetPorthandleAcceptFailuresetHostsetPortshutdowntoString

Field Detail

_acceptChannelback to summary
private volatile ServerSocketChannel _acceptChannel
_acceptedReceiveBufferSizeback to summary
private volatile int _acceptedReceiveBufferSize
_acceptedSendBufferSizeback to summary
private volatile int _acceptedSendBufferSize
_acceptedTcpNoDelayback to summary
private volatile boolean _acceptedTcpNoDelay
_acceptorback to summary
private final AtomicReference<Closeable> _acceptor
_acceptQueueSizeback to summary
private volatile int _acceptQueueSize
_inheritChannelback to summary
private volatile boolean _inheritChannel
_localPortback to summary
private volatile int _localPort
_managerback to summary
private final SelectorManager _manager
_reuseAddressback to summary
private volatile boolean _reuseAddress
_reusePortback to summary
private volatile boolean _reusePort

Constructor Detail

ServerConnectorback to summary
public ServerConnector(Server server)

Construct a ServerConnector with a private instance of HttpConnectionFactory as the only factory.

Parameters
server:Server

The Server this connector will accept connection for.

ServerConnectorback to summary
public ServerConnector(Server server, int acceptors, int selectors)

Construct a ServerConnector with a private instance of HttpConnectionFactory as the only factory.

Parameters
server:Server

The Server this connector will accept connection for.

acceptors:int

the number of acceptor threads to use, or -1 for a default value. Acceptors accept new TCP/IP connections. If 0, then the selector threads are used to accept connections.

selectors:int

the number of selector threads, or <=0 for a default value. Selectors notice and schedule established connection that can make IO progress.

ServerConnectorback to summary
public ServerConnector(Server server, int acceptors, int selectors, ConnectionFactory... factories)

Construct a ServerConnector with a private instance of HttpConnectionFactory as the only factory.

Parameters
server:Server

The Server this connector will accept connection for.

acceptors:int

the number of acceptor threads to use, or -1 for a default value. Acceptors accept new TCP/IP connections. If 0, then the selector threads are used to accept connections.

selectors:int

the number of selector threads, or <=0 for a default value. Selectors notice and schedule established connection that can make IO progress.

factories:ConnectionFactory[]

Zero or more ConnectionFactory instances used to create and configure connections.

ServerConnectorback to summary
public ServerConnector(Server server, ConnectionFactory... factories)

Construct a Server Connector with the passed Connection factories.

Parameters
server:Server

The Server this connector will accept connection for.

factories:ConnectionFactory[]

Zero or more ConnectionFactory instances used to create and configure connections.

ServerConnectorback to summary
public ServerConnector(Server server, SslContextFactory.Server sslContextFactory)

Construct a ServerConnector with a private instance of HttpConnectionFactory as the primary protocol

.
Parameters
server:Server

The Server this connector will accept connection for.

sslContextFactory:SslContextFactory.Server

If non null, then a SslConnectionFactory is instantiated and prepended to the list of HTTP Connection Factory.

ServerConnectorback to summary
public ServerConnector(Server server, int acceptors, int selectors, SslContextFactory.Server sslContextFactory)

Construct a ServerConnector with a private instance of HttpConnectionFactory as the primary protocol

.
Parameters
server:Server

The Server this connector will accept connection for.

acceptors:int

the number of acceptor threads to use, or -1 for a default value. Acceptors accept new TCP/IP connections. If 0, then the selector threads are used to accept connections.

selectors:int

the number of selector threads, or <=0 for a default value. Selectors notice and schedule established connection that can make IO progress.

sslContextFactory:SslContextFactory.Server

If non null, then a SslConnectionFactory is instantiated and prepended to the list of HTTP Connection Factory.

ServerConnectorback to summary
public ServerConnector(Server server, SslContextFactory.Server sslContextFactory, ConnectionFactory... factories)
Parameters
server:Server

The Server this connector will accept connection for.

sslContextFactory:SslContextFactory.Server

If non null, then a SslConnectionFactory is instantiated and prepended to the list of ConnectionFactories, with the first factory being the default protocol for the SslConnectionFactory.

factories:ConnectionFactory[]

Zero or more ConnectionFactory instances used to create and configure connections.

ServerConnectorback to summary
public ServerConnector(Server server, Executor executor, Scheduler scheduler, ByteBufferPool bufferPool, int acceptors, int selectors, ConnectionFactory... factories)
Parameters
server:Server

The server this connector will be accept connection for.

executor:Executor

An executor used to run tasks for handling requests, acceptors and selectors. If null then use the servers executor

scheduler:Scheduler

A scheduler used to schedule timeouts. If null then use the servers scheduler

bufferPool:ByteBufferPool

A ByteBuffer pool used to allocate buffers. If null then create a private pool with default configuration.

acceptors:int

the number of acceptor threads to use, or -1 for a default value. Acceptors accept new TCP/IP connections. If 0, then the selector threads are used to accept connections.

selectors:int

the number of selector threads, or <=0 for a default value. Selectors notice and schedule established connection that can make IO progress.

factories:ConnectionFactory[]

Zero or more ConnectionFactory instances used to create and configure connections.

Method Detail

acceptback to summary
public void accept(int acceptorID) throws IOException

Implements abstract org.eclipse.jetty.server.AbstractConnector.accept.

Annotations
@Override
acceptedback to summary
private void accepted(SocketChannel channel) throws IOException
closeback to summary
public void close()

Overrides org.eclipse.jetty.server.AbstractNetworkConnector.close.

Implements org.eclipse.jetty.server.NetworkConnector.close.

Doc from org.eclipse.jetty.server.NetworkConnector.close.

Performs the activities needed to close the network communication (for example, to stop accepting network connections).

Once a connector has been closed, it cannot be opened again without first calling stop() and it will not be active again until a subsequent call to start()
Annotations
@Override
configureback to summary
protected void configure(Socket socket)
doStartback to summary
protected void doStart() throws Exception

Overrides org.eclipse.jetty.server.AbstractNetworkConnector.doStart.

Doc from org.eclipse.jetty.util.component.ContainerLifeCycle.doStart.

Starts the managed lifecycle beans in the order they were added.

Annotations
@Override
Exceptions
Exception:

Doc from org.eclipse.jetty.util.component.AbstractLifeCycle.doStart.

If there was a problem starting. Will cause a transition to FAILED state

doStopback to summary
protected void doStop() throws Exception

Overrides org.eclipse.jetty.server.AbstractNetworkConnector.doStop.

Doc from org.eclipse.jetty.util.component.ContainerLifeCycle.doStop.

Stops the managed lifecycle beans in the reverse order they were added.

Annotations
@Override
Exceptions
Exception:

Doc from org.eclipse.jetty.util.component.AbstractLifeCycle.doStop.

If there was a problem stopping. Will cause a transition to FAILED state

getAcceptedReceiveBufferSizeback to summary
public int getAcceptedReceiveBufferSize()
Returns:int

the SO_RCVBUF size to set onto the accepted socket. A value of -1 indicates that it is left to its default value.

Annotations
@ManagedAttribute:Accepted Socket SO_RCVBUF
See Also
Socket#getReceiveBufferSize()
getAcceptedSendBufferSizeback to summary
public int getAcceptedSendBufferSize()
Returns:int

the SO_SNDBUF size to set onto the accepted socket. A value of -1 indicates that it is left to its default value.

Annotations
@ManagedAttribute:Accepted Socket SO_SNDBUF
See Also
Socket#getSendBufferSize()
getAcceptedTcpNoDelayback to summary
public boolean getAcceptedTcpNoDelay()
Returns:boolean

whether the accepted socket gets TCP_NODELAY enabled.

Annotations
@ManagedAttribute:Accepted Socket TCP_NODELAY
See Also
Socket#getTcpNoDelay()
getAcceptQueueSizeback to summary
public int getAcceptQueueSize()
Returns:int

the accept queue size

Annotations
@ManagedAttribute:Accept Queue size
getLocalPortback to summary
public int getLocalPort()

Overrides org.eclipse.jetty.server.AbstractNetworkConnector.getLocalPort.

Implements org.eclipse.jetty.server.NetworkConnector.getLocalPort.

Returns:int

Doc from org.eclipse.jetty.server.NetworkConnector.getLocalPort.

The actual port the connector is listening on, or -1 if it has not been opened, or -2 if it has been closed.

Annotations
@Override
@ManagedAttribute:local port
getReuseAddressback to summary
public boolean getReuseAddress()
Returns:boolean

whether rebinding the server socket is allowed with sockets in tear-down states

Annotations
@ManagedAttribute:Server Socket SO_REUSEADDR
See Also
ServerSocket#getReuseAddress()
getSelectorManagerback to summary
public SelectorManager getSelectorManager()
Annotations
@ManagedAttribute:The Selector Manager
getTransportback to summary
public Object getTransport()

Implements org.eclipse.jetty.server.Connector.getTransport.

Doc from org.eclipse.jetty.server.Connector.getTransport.

Get the underlying socket, channel, buffer etc. for the connector..

Returns:Object

the underlying socket, channel, buffer etc. for the connector.

Annotations
@Override
isInheritChannelback to summary
public boolean isInheritChannel()
Returns:boolean

whether this connector uses a channel inherited from the JVM.

See Also
System#inheritedChannel()
isOpenback to summary
public boolean isOpen()

Implements org.eclipse.jetty.server.NetworkConnector.isOpen.

Doc from org.eclipse.jetty.server.NetworkConnector.isOpen.

A Connector may be opened and not started (to reserve a port) or closed and running (to allow graceful shutdown of existing connections)

Returns:boolean

True if the connector is Open.

Annotations
@Override
isReusePortback to summary
public boolean isReusePort()
Returns:boolean

whether it is allowed to bind multiple server sockets to the same host and port

Annotations
@ManagedAttribute:Server Socket SO_REUSEPORT
newEndPointback to summary
protected SocketChannelEndPoint newEndPoint(SocketChannel channel, ManagedSelector selectSet, SelectionKey key) throws IOException
newSelectorManagerback to summary
protected SelectorManager newSelectorManager(Executor executor, Scheduler scheduler, int selectors)
openback to summary
public void open(ServerSocketChannel acceptChannel) throws IOException

Open the connector using the passed ServerSocketChannel. This open method can be called before starting the connector to pass it a ServerSocketChannel that will be used instead of one returned from openAcceptChannel()

Parameters
acceptChannel:ServerSocketChannel

the channel to use

Exceptions
IOException:
if the server channel is not bound
openback to summary
public void open() throws IOException

Overrides org.eclipse.jetty.server.AbstractNetworkConnector.open.

Implements org.eclipse.jetty.server.NetworkConnector.open.

Doc from org.eclipse.jetty.server.NetworkConnector.open.

Performs the activities needed to open the network communication (for example, to start accepting incoming network connections).

Annotations
@Override
Exceptions
IOException:
if this connector cannot be opened
openAcceptChannelback to summary
protected ServerSocketChannel openAcceptChannel() throws IOException

Called by open() to obtain the accepting channel.

Returns:ServerSocketChannel

ServerSocketChannel used to accept connections.

Exceptions
IOException:
if unable to obtain or configure the server channel
setAcceptedReceiveBufferSizeback to summary
public void setAcceptedReceiveBufferSize(int receiveBufferSize)
Parameters
receiveBufferSize:int

the SO_RCVBUF size to set onto the accepted socket. A value of -1 indicates that it is left to its default value.

See Also
Socket#setReceiveBufferSize(int)
setAcceptedSendBufferSizeback to summary
public void setAcceptedSendBufferSize(int sendBufferSize)
Parameters
sendBufferSize:int

the SO_SNDBUF size to set onto the accepted socket. A value of -1 indicates that it is left to its default value.

See Also
Socket#setSendBufferSize(int)
setAcceptedTcpNoDelayback to summary
public void setAcceptedTcpNoDelay(boolean tcpNoDelay)
Parameters
tcpNoDelay:boolean

whether TCP_NODELAY gets enabled on the the accepted socket.

See Also
Socket#setTcpNoDelay(boolean)
setAcceptingback to summary
public void setAccepting(boolean accepting)

Overrides org.eclipse.jetty.server.AbstractConnector.setAccepting.

Annotations
@Override
setAcceptQueueSizeback to summary
public void setAcceptQueueSize(int acceptQueueSize)

Set the accept queue size (also known as accept backlog).

Parameters
acceptQueueSize:int

the accept queue size (also known as accept backlog)

setInheritChannelback to summary
public void setInheritChannel(boolean inheritChannel)

Sets whether this connector uses a channel inherited from the JVM.

If true, the connector first tries to inherit from a channel provided by the system. If there is no inherited channel available, or if the inherited channel is not usable, then it will fall back using ServerSocketChannel.

Use it with xinetd/inetd, to launch an instance of Jetty on demand. The port used to access pages on the Jetty instance is the same as the port used to launch Jetty.

Parameters
inheritChannel:boolean

whether this connector uses a channel inherited from the JVM.

See Also
ServerConnector#openAcceptChannel()
setReuseAddressback to summary
public void setReuseAddress(boolean reuseAddress)
Parameters
reuseAddress:boolean

whether rebinding the server socket is allowed with sockets in tear-down states

See Also
ServerSocket#setReuseAddress(boolean)
setReusePortback to summary
public void setReusePort(boolean reusePort)

Set whether it is allowed to bind multiple server sockets to the same host and port.

Parameters
reusePort:boolean

whether it is allowed to bind multiple server sockets to the same host and port

setSocketOptionback to summary
private <T> void setSocketOption(ServerSocketChannel channel, SocketOption<T> option, T value)
org.eclipse.jetty.server back to summary

protected Class ServerConnector.ServerConnectorManager

extends SelectorManager
Class Inheritance

Field Summary

Inherited from org.eclipse.jetty.io.SelectorManager:
DEFAULT_CONNECT_TIMEOUTLOG

Constructor Summary

AccessConstructor and Description
public
ServerConnectorManager(Executor executor, Scheduler scheduler, int selectors)

Method Summary

Modifier and TypeMethod and Description
protected void
accepted(SelectableChannel
the
channel
)

Overrides org.eclipse.jetty.io.SelectorManager.accepted.

Callback method when a channel is accepted from the ServerSocketChannel passed to acceptor(SelectableChannel).

protected void
endPointClosed(EndPoint
the endpoint being closed
endpoint
)

Overrides org.eclipse.jetty.io.SelectorManager.endPointClosed.

Callback method invoked when an endpoint is closed.

protected void
endPointOpened(EndPoint
the endpoint being opened
endpoint
)

Overrides org.eclipse.jetty.io.SelectorManager.endPointOpened.

Callback method invoked when an endpoint is opened.

public Connection
newConnection(SelectableChannel
the channel associated to the connection
channel
,
EndPoint
the endpoint
endpoint
,
Object
the attachment
attachment
)

Implements abstract org.eclipse.jetty.io.SelectorManager.newConnection.

Factory method to create Connection.

protected SocketChannelEndPoint
newEndPoint(SelectableChannel
the channel associated to the endpoint
channel
,
ManagedSelector
the selector the channel is registered to
selector
,
SelectionKey
the selection key
selectionKey
)

Implements abstract org.eclipse.jetty.io.SelectorManager.newEndPoint.

Factory method to create EndPoint.

public String
toString()

Overrides org.eclipse.jetty.io.SelectorManager.toString.

Returns a string representation of the object.

Inherited from org.eclipse.jetty.io.SelectorManager:
acceptacceptacceptoraddEventListenerchooseSelectorconnectconnectionClosedconnectionFailedconnectionOpeneddoAcceptdoFinishConnectdoStartdoStopexecutegetConnectTimeoutgetExecutorgetSchedulergetSelectorCountgetTotalKeysisConnectionPendingnewSelectornewSelectoronAcceptedonAcceptFailedonAcceptingremoveEventListenersetConnectTimeout

Constructor Detail

ServerConnectorManagerback to summary
public ServerConnectorManager(Executor executor, Scheduler scheduler, int selectors)

Method Detail

acceptedback to summary
protected void accepted(SelectableChannel channel) throws IOException

Overrides org.eclipse.jetty.io.SelectorManager.accepted.

Doc from org.eclipse.jetty.io.SelectorManager.accepted.

Callback method when a channel is accepted from the ServerSocketChannel passed to acceptor(SelectableChannel). The default impl throws an UnsupportedOperationException, so it must be overridden by subclasses if a server channel is provided.

Parameters
channel:SelectableChannel

the

Annotations
@Override
Exceptions
IOException:
if unable to accept channel
endPointClosedback to summary
protected void endPointClosed(EndPoint endpoint)

Overrides org.eclipse.jetty.io.SelectorManager.endPointClosed.

Doc from org.eclipse.jetty.io.SelectorManager.endPointClosed.

Callback method invoked when an endpoint is closed.

Parameters
endpoint:EndPoint

the endpoint being closed

Annotations
@Override
endPointOpenedback to summary
protected void endPointOpened(EndPoint endpoint)

Overrides org.eclipse.jetty.io.SelectorManager.endPointOpened.

Doc from org.eclipse.jetty.io.SelectorManager.endPointOpened.

Callback method invoked when an endpoint is opened.

Parameters
endpoint:EndPoint

the endpoint being opened

Annotations
@Override
newConnectionback to summary
public Connection newConnection(SelectableChannel channel, EndPoint endpoint, Object attachment) throws IOException

Implements abstract org.eclipse.jetty.io.SelectorManager.newConnection.

Doc from org.eclipse.jetty.io.SelectorManager.newConnection.

Factory method to create Connection.

Parameters
channel:SelectableChannel

the channel associated to the connection

endpoint:EndPoint

the endpoint

attachment:Object

the attachment

Returns:Connection

a new connection

Annotations
@Override
Exceptions
IOException:
if unable to create new connection
newEndPointback to summary
protected SocketChannelEndPoint newEndPoint(SelectableChannel channel, ManagedSelector selector, SelectionKey selectionKey) throws IOException

Implements abstract org.eclipse.jetty.io.SelectorManager.newEndPoint.

Doc from org.eclipse.jetty.io.SelectorManager.newEndPoint.

Factory method to create EndPoint.

This method is invoked as a result of the registration of a channel via connect(SelectableChannel, Object) or accept(SelectableChannel).

Parameters
channel:SelectableChannel

the channel associated to the endpoint

selector:ManagedSelector

the selector the channel is registered to

selectionKey:SelectionKey

the selection key

Returns:SocketChannelEndPoint

a new endpoint

Annotations
@Override
Exceptions
IOException:
if the endPoint cannot be created
toStringback to summary
public String toString()

Overrides org.eclipse.jetty.io.SelectorManager.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override