|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eclipse.jetty.util.component.AbstractLifeCycle org.eclipse.jetty.http.HttpBuffers org.eclipse.jetty.server.AbstractConnector org.eclipse.jetty.server.nio.AbstractNIOConnector org.eclipse.jetty.server.nio.SelectChannelConnector
public class SelectChannelConnector
Selecting NIO connector.
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 Continuation
, threadless waits are supported. When
a filter or servlet calls getEvent on a Continuation, a org.eclipse.jetty.server.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.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle |
---|
LifeCycle.Listener |
Field Summary | |
---|---|
protected ServerSocketChannel |
_acceptChannel
|
Fields inherited from class org.eclipse.jetty.server.AbstractConnector |
---|
_lowResourceMaxIdleTime, _maxIdleTime, _soLingerTime |
Fields inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle |
---|
_listeners, FAILED, RUNNING, STARTED, STARTING, STOPPED, STOPPING |
Constructor Summary | |
---|---|
SelectChannelConnector()
Constructor. |
Method Summary | |
---|---|
void |
accept(int acceptorID)
|
void |
close()
|
void |
customize(EndPoint endpoint,
Request request)
Customize a request for an endpoint. |
protected void |
doStart()
|
protected void |
doStop()
|
void |
dump()
|
Object |
getConnection()
|
int |
getLocalPort()
|
long |
getLowResourcesConnections()
|
long |
getLowResourcesMaxIdleTime()
|
protected Connection |
newConnection(SocketChannel channel,
SelectChannelEndPoint endpoint)
|
protected SelectChannelEndPoint |
newEndPoint(SocketChannel channel,
SelectorManager.SelectSet selectSet,
SelectionKey key)
|
void |
open()
Opens the connector |
void |
persist(EndPoint endpoint)
Persist an endpoint. |
void |
setLowResourceMaxIdleTime(int lowResourcesMaxIdleTime)
Set the period in ms that a connection is allowed to be idle when this there are more than getLowResourcesConnections() connections. |
void |
setLowResourcesConnections(long lowResourcesConnections)
Set the number of connections, which if exceeded places this manager in low resources state. |
void |
setLowResourcesMaxIdleTime(long lowResourcesMaxIdleTime)
Deprecated. use setLowResourceMaxIdleTime(int) |
void |
setMaxIdleTime(int maxIdleTime)
Set the maximum Idle time for a connection, which roughly translates to the Socket.setSoTimeout(int) call, although with NIO
implementations other mechanisms may be used to implement the timeout. |
Methods inherited from class org.eclipse.jetty.server.nio.AbstractNIOConnector |
---|
getUseDirectBuffers, isRequestHeader, isResponseHeader, newRequestBuffer, newRequestHeader, newResponseBuffer, newResponseHeader, setUseDirectBuffers |
Methods inherited from class org.eclipse.jetty.http.HttpBuffers |
---|
getHeaderBufferSize, getRequestBuffers, getRequestBufferSize, getRequestHeaderSize, getResponseBuffers, getResponseBufferSize, getResponseHeaderSize, setHeaderBufferSize, setRequestBufferSize, setRequestHeaderSize, setResponseBufferSize, setResponseHeaderSize |
Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle |
---|
addLifeCycleListener, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.eclipse.jetty.server.Connector |
---|
getRequestBuffers, getRequestBufferSize, getRequestHeaderSize, getResponseBuffers, getResponseBufferSize, getResponseHeaderSize, setRequestBufferSize, setRequestHeaderSize, setResponseBufferSize, setResponseHeaderSize |
Methods inherited from interface org.eclipse.jetty.util.component.LifeCycle |
---|
addLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop |
Field Detail |
---|
protected ServerSocketChannel _acceptChannel
Constructor Detail |
---|
public SelectChannelConnector()
Method Detail |
---|
public void accept(int acceptorID) throws IOException
accept
in class AbstractConnector
IOException
public void close() throws IOException
IOException
public void customize(EndPoint endpoint, Request request) throws IOException
Connector
customize
in interface Connector
customize
in class AbstractConnector
IOException
public void persist(EndPoint endpoint) throws IOException
Connector
persist
in interface Connector
persist
in class AbstractConnector
IOException
public Object getConnection()
public int getLocalPort()
public void open() throws IOException
Connector
IOException
public void setMaxIdleTime(int maxIdleTime)
AbstractConnector
Socket.setSoTimeout(int)
call, although with NIO
implementations other mechanisms may be used to implement the timeout.
The max idle time is applied: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).
setMaxIdleTime
in interface Connector
setMaxIdleTime
in class AbstractConnector
maxIdleTime
- The maxIdleTime to set.public long getLowResourcesConnections()
public void setLowResourcesConnections(long lowResourcesConnections)
lowResourcesConnections
- the number of connections#setLowResourcesMaxIdleTime(long)}
public long getLowResourcesMaxIdleTime()
public void setLowResourcesMaxIdleTime(long lowResourcesMaxIdleTime)
setLowResourceMaxIdleTime(int)
getLowResourcesConnections()
connections. This allows the server to rapidly close idle connections
in order to gracefully handle high load situations.
lowResourcesMaxIdleTime
- the period in ms that a connection is allowed to be idle when resources are low.#setMaxIdleTime(long)}
public void setLowResourceMaxIdleTime(int lowResourcesMaxIdleTime)
getLowResourcesConnections()
connections. This allows the server to rapidly close idle connections
in order to gracefully handle high load situations.
setLowResourceMaxIdleTime
in interface Connector
setLowResourceMaxIdleTime
in class AbstractConnector
lowResourcesMaxIdleTime
- the period in ms that a connection is allowed to be idle when resources are low.#setMaxIdleTime(long)}
protected void doStart() throws Exception
doStart
in class AbstractConnector
Exception
protected void doStop() throws Exception
doStop
in class AbstractConnector
Exception
protected SelectChannelEndPoint newEndPoint(SocketChannel channel, SelectorManager.SelectSet selectSet, SelectionKey key) throws IOException
IOException
protected Connection newConnection(SocketChannel channel, SelectChannelEndPoint endpoint)
public void dump()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |