This connector uses efficient NIO buffers with a non blocking threading model. Direct NIO buffers are used and threads are only allocated to connections with requests. Synchronization is used to simulate blocking for the servlet API, and any unflushed content at the end of request handling is written asynchronously.
This connector is best used when there are a many connections that have idle periods.
When used with org.mortbay.util.ajax.Continuation, threadless waits are supported. When
a filter or servlet calls getEvent on a Continuation, a org.mortbay.jetty.RetryRequest
runtime exception is thrown to allow the thread to exit the current request handling. Jetty will
catch this exception and will not send a response to the client. Instead the thread is released
and the Continuation is placed on the timer queue. If the Continuation timeout expires, or it's
resume method is called, then the request is again allocated a thread and the request is retried.
The limitation of this approach is that request content is not available on the retried request,
thus if possible it should be read after the continuation or saved as a request attribute or as the
associated object of the Continuation instance.
| Modifier and Type | Field and Description |
|---|---|
| private transient ServerSocketChannel | |
| private long | |
| private long | |
| private SelectorManager |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public void | |
| public void | customize(EndPoint endpoint, Request request)
Overrides org. Implements org. |
| protected void | |
| protected void | |
| public Object | |
| public int | |
| public long | |
| public long | |
| protected Connection | |
| protected SelectChannelEndPoint | |
| public void | |
| public void | persist(EndPoint endpoint)
Overrides org. Implements org. |
| public void | setLowResourceMaxIdleTime(int
the period in ms that a connection is allowed to be idle when resources are low. lowResourcesMaxIdleTime)Overrides org. Implements org. getLowResourcesConnections() connections.
|
| public void | setLowResourcesConnections(long
the number of connections lowResourcesConnections)Set the number of connections, which if exceeded places this manager in low resources state. |
| public void | setLowResourcesMaxIdleTime(long
the period in ms that a connection is allowed to be idle when resources are low. lowResourcesMaxIdleTime)
Deprecated
use
Set the period in ms that a connection is allowed to be idle when this there are more
than setLowResourceMaxIdleTime(int)
getLowResourcesConnections() connections.
|
| public void | setMaxIdleTime(int
The maxIdleTime to set. maxIdleTime)Overrides org. Implements org. Socket#setSoTimeout(int) call, although with NIO
implementations other mechanisms may be used to implement the timeout.
|
| _acceptChannel | back to summary |
|---|---|
| private transient ServerSocketChannel _acceptChannel | |
| _lowResourcesConnections | back to summary |
|---|---|
| private long _lowResourcesConnections | |
| _lowResourcesMaxIdleTime | back to summary |
|---|---|
| private long _lowResourcesMaxIdleTime | |
| _manager | back to summary |
|---|---|
| private SelectorManager _manager | |
| SelectChannelConnector | back to summary |
|---|---|
| public SelectChannelConnector() Constructor. | |
| accept | back to summary |
|---|---|
| public void accept(int acceptorID) throws IOException Implements abstract org. | |
| close | back to summary |
|---|---|
| public void close() throws IOException Implements org. | |
| customize | back to summary |
|---|---|
| public void customize(EndPoint endpoint, Request request) throws IOException Overrides org. Implements org. Doc from org. Customize a request for an endpoint. Called on every request to allow customization of the request for the particular endpoint (eg security properties from a SSL connection).
| |
| doStart | back to summary |
|---|---|
| protected void doStart() throws Exception Overrides org. | |
| doStop | back to summary |
|---|---|
| protected void doStop() throws Exception Overrides org. | |
| getConnection | back to summary |
|---|---|
| public Object getConnection() Implements org.
| |
| getLocalPort | back to summary |
|---|---|
| public int getLocalPort() Implements org.
| |
| getLowResourcesConnections | back to summary |
|---|---|
public long getLowResourcesConnections()
| |
| getLowResourcesMaxIdleTime | back to summary |
|---|---|
public long getLowResourcesMaxIdleTime()
| |
| newConnection | back to summary |
|---|---|
| protected Connection newConnection(SocketChannel channel, final SelectChannelEndPoint endpoint) | |
| newEndPoint | back to summary |
|---|---|
| protected SelectChannelEndPoint newEndPoint(SocketChannel channel, SelectorManager. | |
| open | back to summary |
|---|---|
| public void open() throws IOException Implements org. Doc from org. Opens the connector | |
| persist | back to summary |
|---|---|
| public void persist(EndPoint endpoint) throws IOException Overrides org. Implements org. Doc from org. Persist an endpoint. Called after every request if the connection is to remain open.
| |
| setLowResourceMaxIdleTime | back to summary |
|---|---|
| public void setLowResourceMaxIdleTime(int lowResourcesMaxIdleTime) Overrides org. Implements org. Set the period in ms that a connection is allowed to be idle when this there are more
than
| |
| setLowResourcesConnections | back to summary |
|---|---|
| public void setLowResourcesConnections(long lowResourcesConnections) Set the number of connections, which if exceeded places this manager in low resources state. This is not an exact measure as the connection count is averaged over the select sets.
| |
| setLowResourcesMaxIdleTime | back to summary |
|---|---|
| public void setLowResourcesMaxIdleTime(long lowResourcesMaxIdleTime)
Deprecated Set the period in ms that a connection is allowed to be idle when this there are more
than
| |
| setMaxIdleTime | back to summary |
|---|---|
| public void setMaxIdleTime(int maxIdleTime) Overrides org. Implements org. Doc from org. Set the maximum Idle time for a connection, which roughly translates
to the
Previously, Jetty supported separate idle timeouts and IO operation timeouts, however the expense of changing the value of soTimeout was significant, so these timeouts were merged. With the advent of NIO, it may be possible to again differentiate these values (if there is demand).
| |