|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object 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
Server socket acceptor thread. |
static interface |
JIoEndpoint.Handler
Bare bones interface used for socket processing. |
class |
JIoEndpoint.Poller
Poller class. |
protected class |
JIoEndpoint.SocketEventProcessor
This class is the equivalent of the Worker, but will simply use in an external Executor thread pool. |
static class |
JIoEndpoint.SocketInfo
Socket list class, used to avoid using a possibly large amount of objects with very little actual use. |
class |
JIoEndpoint.SocketList
Socket list class, used to avoid using a possibly large amount of objects with very little actual use. |
protected class |
JIoEndpoint.SocketProcessor
This class is the equivalent of the Worker, but will simply use in an external Executor thread pool. |
class |
JIoEndpoint.SocketTimeouts
Socket list class, used to avoid using a possibly large amount of objects with very little actual use. |
protected class |
JIoEndpoint.Worker
|
class |
JIoEndpoint.WorkerStack
|
Field Summary | |
---|---|
protected int |
acceptorThreadCount
Acceptor thread count. |
protected java.net.InetAddress |
address
Address for the server socket. |
protected int |
backlog
Allows the server developer to specify the backlog that should be used for server sockets. |
static java.lang.String |
CERTIFICATE_KEY
The Request attribute key for the client certificate chain. |
static java.lang.String |
CIPHER_SUITE_KEY
The Request attribute key for the cipher suite. |
protected int |
curThreads
Current worker threads count. |
protected int |
curThreadsBusy
Current worker threads busy count. |
protected boolean |
daemon
The default is true - the created threads will be in daemon mode. |
protected JIoEndpoint.Poller |
eventPoller
The socket poller used for event support. |
protected java.util.concurrent.Executor |
executor
External Executor based thread pool. |
protected JIoEndpoint.Handler |
handler
Handling of accepted sockets. |
protected boolean |
initialized
Track the initialization state of the endpoint. |
protected int |
keepAliveTimeout
Keep-Alive timeout. |
static java.lang.String |
KEY_SIZE_KEY
The Request attribute key for the key size. |
protected static org.jboss.logging.Logger |
log
|
protected int |
maxThreads
Maximum amount of worker threads. |
protected java.lang.String |
name
Name of the thread pool, which will be used for naming child threads. |
protected boolean |
paused
Will be set to true whenever the endpoint is paused. |
protected int |
pollerSize
Size of the socket poller. |
protected int |
port
Server socket port. |
protected boolean |
running
Running state of the endpoint. |
protected int |
sequence
Sequence number used to generate thread names. |
protected java.net.ServerSocket |
serverSocket
Associated server socket. |
protected ServerSocketFactory |
serverSocketFactory
Server socket factory. |
static java.lang.String |
SESSION_ID_KEY
The Request attribute key for the session id. |
protected StringManager |
sm
|
protected int |
soLinger
Socket linger. |
protected int |
soTimeout
Socket timeout. |
protected boolean |
tcpNoDelay
Socket TCP no delay. |
protected int |
threadPriority
Priority of the acceptor and poller threads. |
protected JIoEndpoint.WorkerStack |
workers
Available workers. |
Constructor Summary | |
---|---|
JIoEndpoint()
|
Method Summary | |
---|---|
protected JIoEndpoint.Worker |
createWorkerThread()
Create (or allocate) and return an available processor for use in processing a specific HTTP request, if possible. |
void |
destroy()
Deallocate APR memory pools, and close server socket. |
int |
getAcceptorThreadCount()
|
java.net.InetAddress |
getAddress()
|
int |
getBacklog()
|
int |
getCurrentThreadCount()
|
int |
getCurrentThreadsBusy()
|
boolean |
getDaemon()
|
JIoEndpoint.Poller |
getEventPoller()
|
java.util.concurrent.Executor |
getExecutor()
|
JIoEndpoint.Handler |
getHandler()
|
int |
getKeepAliveTimeout()
|
int |
getMaxThreads()
|
java.lang.String |
getName()
|
int |
getPollerSize()
|
int |
getPort()
|
ServerSocketFactory |
getServerSocketFactory()
|
int |
getSoLinger()
|
int |
getSoTimeout()
|
boolean |
getTcpNoDelay()
|
int |
getThreadPriority()
|
protected JIoEndpoint.Worker |
getWorkerThread()
Return a new worker thread, and block while to worker is available. |
void |
init()
|
boolean |
isPaused()
|
boolean |
isRunning()
|
protected JIoEndpoint.Worker |
newWorkerThread()
Create and return a new processor suitable for processing HTTP requests and returning the corresponding responses. |
void |
pause()
|
protected boolean |
processSocket(java.net.Socket socket)
Process given socket. |
protected boolean |
processSocket(java.net.Socket socket,
SocketStatus status)
Process given socket for an event. |
protected void |
recycleWorkerThread(JIoEndpoint.Worker workerThread)
Recycle the specified Processor so that it can be used again. |
void |
resume()
|
void |
setAcceptorThreadCount(int acceptorThreadCount)
|
void |
setAddress(java.net.InetAddress address)
|
void |
setBacklog(int backlog)
|
void |
setDaemon(boolean b)
|
void |
setExecutor(java.util.concurrent.Executor executor)
|
void |
setHandler(JIoEndpoint.Handler handler)
|
void |
setKeepAliveTimeout(int keepAliveTimeout)
|
void |
setMaxThreads(int maxThreads)
|
void |
setName(java.lang.String name)
|
void |
setPollerSize(int pollerSize)
|
void |
setPort(int port)
|
void |
setServerSocketFactory(ServerSocketFactory factory)
|
protected boolean |
setSocketOptions(java.net.Socket socket)
Set the options for the current socket. |
void |
setSoLinger(int soLinger)
|
void |
setSoTimeout(int soTimeout)
|
void |
setTcpNoDelay(boolean tcpNoDelay)
|
void |
setThreadPriority(int threadPriority)
|
void |
start()
|
void |
stop()
|
protected void |
unlockAccept()
Unlock the accept by using a local connection. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static org.jboss.logging.Logger log
protected StringManager sm
public static final java.lang.String CIPHER_SUITE_KEY
public static final java.lang.String KEY_SIZE_KEY
public static final java.lang.String CERTIFICATE_KEY
public static final java.lang.String SESSION_ID_KEY
protected JIoEndpoint.WorkerStack workers
protected volatile boolean running
protected volatile boolean paused
protected boolean initialized
protected int curThreadsBusy
protected int curThreads
protected int sequence
protected java.net.ServerSocket serverSocket
protected int acceptorThreadCount
protected java.util.concurrent.Executor executor
protected int maxThreads
protected int threadPriority
protected int pollerSize
protected int keepAliveTimeout
protected int port
protected java.net.InetAddress address
protected JIoEndpoint.Handler handler
protected int backlog
protected boolean tcpNoDelay
protected int soLinger
protected int soTimeout
protected boolean daemon
protected java.lang.String name
protected ServerSocketFactory serverSocketFactory
protected JIoEndpoint.Poller eventPoller
Constructor Detail |
---|
public JIoEndpoint()
Method Detail |
---|
public void setAcceptorThreadCount(int acceptorThreadCount)
public int getAcceptorThreadCount()
public void setExecutor(java.util.concurrent.Executor executor)
public java.util.concurrent.Executor getExecutor()
public void setMaxThreads(int maxThreads)
public int getMaxThreads()
public void setThreadPriority(int threadPriority)
public int getThreadPriority()
public void setPollerSize(int pollerSize)
public int getPollerSize()
public int getKeepAliveTimeout()
public void setKeepAliveTimeout(int keepAliveTimeout)
public int getPort()
public void setPort(int port)
public java.net.InetAddress getAddress()
public void setAddress(java.net.InetAddress address)
public void setHandler(JIoEndpoint.Handler handler)
public JIoEndpoint.Handler getHandler()
public void setBacklog(int backlog)
public int getBacklog()
public boolean getTcpNoDelay()
public void setTcpNoDelay(boolean tcpNoDelay)
public int getSoLinger()
public void setSoLinger(int soLinger)
public int getSoTimeout()
public void setSoTimeout(int soTimeout)
public void setDaemon(boolean b)
public boolean getDaemon()
public void setName(java.lang.String name)
public java.lang.String getName()
public void setServerSocketFactory(ServerSocketFactory factory)
public ServerSocketFactory getServerSocketFactory()
public JIoEndpoint.Poller getEventPoller()
public boolean isRunning()
public boolean isPaused()
public int getCurrentThreadCount()
public int getCurrentThreadsBusy()
public void init() throws java.lang.Exception
java.lang.Exception
public void start() throws java.lang.Exception
java.lang.Exception
public void pause()
public void resume()
public void stop()
public void destroy() throws java.lang.Exception
java.lang.Exception
protected void unlockAccept()
protected boolean setSocketOptions(java.net.Socket socket)
protected JIoEndpoint.Worker createWorkerThread()
null
instead.
protected JIoEndpoint.Worker newWorkerThread()
protected JIoEndpoint.Worker getWorkerThread()
protected void recycleWorkerThread(JIoEndpoint.Worker workerThread)
workerThread
- The processor to be recycledprotected boolean processSocket(java.net.Socket socket)
protected boolean processSocket(java.net.Socket socket, SocketStatus status)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |