|
Apache Tomcat 7.0.28 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.tomcat.util.net.AbstractEndpoint org.apache.tomcat.util.net.JIoEndpoint
public class JIoEndpoint
Handle incoming TCP connections. This class implement a simple server model: one listener thread accepts on a socket and creates a new worker thread for each incoming connection. More advanced Endpoints will reuse the threads, use queues, etc.
Nested Class Summary | |
---|---|
protected class |
JIoEndpoint.Acceptor
The background thread that listens for incoming TCP/IP connections and hands them off to an appropriate processor. |
protected class |
JIoEndpoint.AsyncTimeout
Async timeout thread |
static interface |
JIoEndpoint.Handler
Bare bones interface used for socket processing. |
protected class |
JIoEndpoint.SocketProcessor
This class is the equivalent of the Worker, but will simply use in an external Executor thread pool. |
Nested classes/interfaces inherited from class org.apache.tomcat.util.net.AbstractEndpoint |
---|
AbstractEndpoint.BindState |
Field Summary | |
---|---|
protected JIoEndpoint.Handler |
handler
Handling of accepted sockets. |
protected ServerSocket |
serverSocket
Associated server socket. |
protected ServerSocketFactory |
serverSocketFactory
Server socket factory. |
protected ConcurrentLinkedQueue<SocketWrapper<Socket>> |
waitingRequests
|
Fields inherited from class org.apache.tomcat.util.net.AbstractEndpoint |
---|
acceptors, acceptorThreadCount, acceptorThreadPriority, attributes, internalExecutor, paused, running, sm, socketProperties, threadPriority |
Constructor Summary | |
---|---|
JIoEndpoint()
|
Method Summary | |
---|---|
void |
bind()
|
protected AbstractEndpoint.Acceptor |
createAcceptor()
Hook to allow Endpoints to provide a specific Acceptor implementation. |
boolean |
getDeferAccept()
|
JIoEndpoint.Handler |
getHandler()
|
int |
getLocalPort()
Port in use. |
protected Log |
getLog()
|
ServerSocketFactory |
getServerSocketFactory()
|
boolean |
getUseComet()
|
boolean |
getUseCometTimeout()
|
boolean |
getUsePolling()
|
boolean |
getUseSendfile()
|
protected boolean |
processSocket(Socket socket)
Process a new connection from a new client. |
boolean |
processSocketAsync(SocketWrapper<Socket> socket,
SocketStatus status)
Process an existing async connection. |
void |
setHandler(JIoEndpoint.Handler handler)
|
void |
setServerSocketFactory(ServerSocketFactory factory)
|
protected boolean |
setSocketOptions(Socket socket)
Configure the socket. |
void |
startInternal()
|
void |
stopInternal()
|
void |
unbind()
Deallocate APR memory pools, and close server socket. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected ServerSocket serverSocket
protected JIoEndpoint.Handler handler
protected ServerSocketFactory serverSocketFactory
protected ConcurrentLinkedQueue<SocketWrapper<Socket>> waitingRequests
Constructor Detail |
---|
public JIoEndpoint()
Method Detail |
---|
public void setHandler(JIoEndpoint.Handler handler)
public JIoEndpoint.Handler getHandler()
public void setServerSocketFactory(ServerSocketFactory factory)
public ServerSocketFactory getServerSocketFactory()
public int getLocalPort()
getLocalPort
in class AbstractEndpoint
public boolean getUseSendfile()
getUseSendfile
in class AbstractEndpoint
public boolean getUseComet()
getUseComet
in class AbstractEndpoint
public boolean getUseCometTimeout()
getUseCometTimeout
in class AbstractEndpoint
public boolean getDeferAccept()
getDeferAccept
in class AbstractEndpoint
public boolean getUsePolling()
getUsePolling
in class AbstractEndpoint
public void bind() throws Exception
bind
in class AbstractEndpoint
Exception
public void startInternal() throws Exception
startInternal
in class AbstractEndpoint
Exception
public void stopInternal()
stopInternal
in class AbstractEndpoint
public void unbind() throws Exception
unbind
in class AbstractEndpoint
Exception
protected AbstractEndpoint.Acceptor createAcceptor()
AbstractEndpoint
createAcceptor
in class AbstractEndpoint
protected boolean setSocketOptions(Socket socket)
protected boolean processSocket(Socket socket)
socket
- The socket associated with the client.
true
if the socket is passed to the
executor, false
if something went wrong or
if the endpoint is shutting down. Returning
false
is an indication to close the socket
immediately.public boolean processSocketAsync(SocketWrapper<Socket> socket, SocketStatus status)
socket
- The socket associated with the client.status
- Only OPEN and TIMEOUT are used. The others are used for
Comet requests that are not supported by the BIO (JIO)
Connector.
true
if the socket is passed to the
executor, false
if something went wrong.
Returning false
is an indication to close
the socket immediately.protected Log getLog()
getLog
in class AbstractEndpoint
|
Apache Tomcat 7.0.28 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |