|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.tomcat.util.net.NioEndpoint
public class NioEndpoint
NIO tailored thread pool, providing the following services:
Nested Class Summary | |
---|---|
protected class |
NioEndpoint.Acceptor
Server socket acceptor thread. |
static interface |
NioEndpoint.Handler
Bare bones interface used for socket processing. |
static class |
NioEndpoint.KeyAttachment
|
class |
NioEndpoint.NioBufferHandler
|
class |
NioEndpoint.Poller
Poller class. |
class |
NioEndpoint.PollerEvent
PollerEvent, cacheable object for poller events to avoid GC |
protected class |
NioEndpoint.SocketEventProcessor
This class is the equivalent of the Worker, but will simply use in an external Executor thread pool. |
protected class |
NioEndpoint.SocketOptionsProcessor
This class is the equivalent of the Worker, but will simply use in an external Executor thread pool. |
protected class |
NioEndpoint.SocketProcessor
This class is the equivalent of the Worker, but will simply use in an external Executor thread pool. |
protected class |
NioEndpoint.Worker
Server processor class. |
class |
NioEndpoint.WorkerStack
|
Field Summary | |
---|---|
protected int |
acceptorThreadCount
Acceptor thread count. |
protected java.net.InetAddress |
address
Address for the server socket. |
protected java.lang.String |
algorithm
|
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 java.lang.String |
ciphers
|
protected java.lang.String[] |
ciphersarr
|
protected boolean |
clientAuth
|
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 java.util.concurrent.ConcurrentLinkedQueue<NioEndpoint.PollerEvent> |
eventCache
Cache for poller events |
protected java.util.concurrent.Executor |
executor
External Executor based thread pool. |
protected int |
firstReadTimeout
Timeout on first request read before going to the poller, in ms. |
protected NioEndpoint.Handler |
handler
Handling of accepted sockets. |
protected boolean |
initialized
Track the initialization state of the endpoint. |
static java.lang.String |
KEY_SIZE_KEY
The Request attribute key for the key size. |
protected java.util.concurrent.ConcurrentLinkedQueue<NioEndpoint.KeyAttachment> |
keyCache
Cache for key attachment objects |
protected java.lang.String |
keystoreFile
|
protected java.lang.String |
keystorePass
|
protected java.lang.String |
keystoreType
|
protected static Log |
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 java.util.concurrent.ConcurrentLinkedQueue<NioChannel> |
nioChannels
Bytebuffer cache, each channel holds a set of buffers (two, except for SSL holds four) |
static int |
OP_REGISTER
|
protected boolean |
paused
Will be set to true whenever the endpoint is paused. |
protected int |
pollerRoundRobin
|
protected NioEndpoint.Poller[] |
pollers
The socket poller. |
protected int |
pollerThreadCount
Poller thread count. |
protected int |
port
Server socket port. |
protected boolean |
running
Running state of the endpoint. |
protected boolean |
secure
|
protected NioSelectorPool |
selectorPool
|
protected long |
selectorTimeout
|
protected int |
sequence
Sequence number used to generate thread names. |
protected java.nio.channels.ServerSocketChannel |
serverSock
Server socket "pointer". |
static java.lang.String |
SESSION_ID_KEY
The Request attribute key for the session id. |
protected static StringManager |
sm
|
protected SocketProperties |
socketProperties
|
protected javax.net.ssl.SSLContext |
sslContext
|
protected boolean |
SSLEnabled
SSL engine. |
protected java.lang.String |
sslEnabledProtocols
|
protected java.lang.String[] |
sslEnabledProtocolsarr
|
protected java.lang.String |
sslProtocol
|
protected int |
threadPriority
Priority of the acceptor and poller threads. |
protected boolean |
useComet
Allow comet request handling. |
protected NioEndpoint.WorkerStack |
workers
Available workers. |
Constructor Summary | |
---|---|
NioEndpoint()
|
Method Summary | |
---|---|
protected javax.net.ssl.SSLEngine |
createSSLEngine()
|
protected NioEndpoint.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()
|
java.lang.String |
getAlgorithm()
|
int |
getBacklog()
|
java.lang.String |
getCiphers()
|
boolean |
getClientAuth()
|
NioEndpoint.Poller |
getCometPoller0()
The socket poller used for Comet support. |
int |
getCurrentThreadCount()
Return the amount of threads that are managed by the pool. |
int |
getCurrentThreadsBusy()
Return the amount of threads currently busy. |
boolean |
getDaemon()
|
java.util.concurrent.Executor |
getExecutor()
|
int |
getFirstReadTimeout()
|
NioEndpoint.Handler |
getHandler()
|
int |
getKeepAliveCount()
Number of keepalive sockets. |
java.lang.String |
getKeystore()
|
java.lang.String |
getKeystoreFile()
|
java.lang.String |
getKeystorePass()
|
java.lang.String |
getKeystoreType()
|
int |
getMaxSpareThreads()
Dummy maxSpareThreads property. |
int |
getMaxThreads()
|
int |
getMinSpareThreads()
Dummy minSpareThreads property. |
java.lang.String |
getName()
|
NioEndpoint.Poller |
getPoller0()
|
int |
getPollerThreadCount()
|
int |
getPort()
|
int |
getReadBufSize()
|
boolean |
getSecure()
|
NioSelectorPool |
getSelectorPool()
|
long |
getSelectorTimeout()
|
protected int |
getSequence()
Get a sequence number used for thread naming. |
SocketProperties |
getSocketProperties()
|
int |
getSoLinger()
Socket linger. |
int |
getSoTimeout()
Socket timeout. |
javax.net.ssl.SSLContext |
getSSLContext()
|
java.lang.String |
getSslProtocol()
|
boolean |
getTcpNoDelay()
Socket TCP no delay. |
int |
getThreadPriority()
|
boolean |
getUseComet()
|
protected NioEndpoint.Worker |
getWorkerThread()
Return a new worker thread, and block while to worker is available. |
int |
getWriteBufSize()
|
void |
init()
Initialize the endpoint. |
boolean |
isPaused()
Return the state of the endpoint. |
boolean |
isRunning()
Return the state of the endpoint. |
boolean |
isSSLEnabled()
|
protected NioEndpoint.Worker |
newWorkerThread()
Create and return a new processor suitable for processing HTTP requests and returning the corresponding responses. |
void |
pause()
Pause the endpoint, which will make it stop accepting new sockets. |
protected boolean |
processSocket(NioChannel socket)
Process given socket. |
protected boolean |
processSocket(NioChannel socket,
SocketStatus status)
Process given socket for an event. |
protected boolean |
processSocket(java.nio.channels.SocketChannel socket)
|
protected void |
recycleWorkerThread(NioEndpoint.Worker workerThread)
Recycle the specified Processor so that it can be used again. |
void |
resume()
Resume the endpoint, which will make it start accepting new sockets again. |
void |
setAcceptorThreadCount(int acceptorThreadCount)
|
void |
setAddress(java.net.InetAddress address)
|
void |
setAlgorithm(java.lang.String s)
|
void |
setBacklog(int backlog)
|
void |
setCiphers(java.lang.String s)
|
void |
setClientAuth(boolean b)
|
void |
setDaemon(boolean b)
|
void |
setExecutor(java.util.concurrent.Executor executor)
|
void |
setFirstReadTimeout(int firstReadTimeout)
|
void |
setHandler(NioEndpoint.Handler handler)
|
void |
setKeystore(java.lang.String s)
|
void |
setKeystoreFile(java.lang.String s)
|
void |
setKeystorePass(java.lang.String s)
|
void |
setKeystoreType(java.lang.String s)
|
void |
setMaxThreads(int maxThreads)
|
void |
setName(java.lang.String name)
|
void |
setPollerThreadCount(int pollerThreadCount)
|
void |
setPort(int port)
|
void |
setProperty(java.lang.String name,
java.lang.String value)
Generic properties, introspected |
void |
setSecure(boolean b)
|
void |
setSelectorPool(NioSelectorPool selectorPool)
|
void |
setSelectorTimeout(long timeout)
|
protected boolean |
setSocketOptions(java.nio.channels.SocketChannel socket)
Process the specified connection. |
void |
setSocketProperties(SocketProperties socketProperties)
|
void |
setSoLinger(int soLinger)
|
void |
setSoTimeout(int soTimeout)
|
void |
setSSLContext(javax.net.ssl.SSLContext c)
|
void |
setSSLEnabled(boolean SSLEnabled)
|
void |
setSslEnabledProtocols(java.lang.String s)
|
void |
setSslProtocol(java.lang.String s)
|
void |
setTcpNoDelay(boolean tcpNoDelay)
|
void |
setThreadPriority(int threadPriority)
|
void |
setUseComet(boolean useComet)
|
void |
start()
Start the APR endpoint, creating acceptor, poller threads. |
void |
stop()
Stop the endpoint. |
protected void |
unlockAccept()
Unlock the server socket accept using a bogus connection. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static Log log
protected static 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
public static final int OP_REGISTER
protected NioEndpoint.WorkerStack workers
protected volatile boolean running
protected volatile boolean paused
protected boolean initialized
protected int curThreadsBusy
protected int curThreads
protected int sequence
protected NioSelectorPool selectorPool
protected java.nio.channels.ServerSocketChannel serverSock
protected java.util.concurrent.ConcurrentLinkedQueue<NioEndpoint.KeyAttachment> keyCache
protected java.util.concurrent.ConcurrentLinkedQueue<NioEndpoint.PollerEvent> eventCache
protected java.util.concurrent.ConcurrentLinkedQueue<NioChannel> nioChannels
protected java.util.concurrent.Executor executor
protected int maxThreads
protected int threadPriority
protected int port
protected java.net.InetAddress address
protected NioEndpoint.Handler handler
protected int backlog
protected SocketProperties socketProperties
protected int firstReadTimeout
protected boolean daemon
protected java.lang.String name
protected boolean useComet
protected int acceptorThreadCount
protected int pollerThreadCount
protected long selectorTimeout
protected NioEndpoint.Poller[] pollers
protected int pollerRoundRobin
protected java.lang.String keystoreFile
protected java.lang.String algorithm
protected boolean clientAuth
protected java.lang.String keystorePass
protected java.lang.String keystoreType
protected java.lang.String sslProtocol
protected java.lang.String sslEnabledProtocols
protected java.lang.String[] sslEnabledProtocolsarr
protected java.lang.String ciphers
protected java.lang.String[] ciphersarr
protected boolean SSLEnabled
protected boolean secure
protected javax.net.ssl.SSLContext sslContext
Constructor Detail |
---|
public NioEndpoint()
Method Detail |
---|
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 int getPort()
public void setPort(int port)
public java.net.InetAddress getAddress()
public void setAddress(java.net.InetAddress address)
public void setHandler(NioEndpoint.Handler handler)
public NioEndpoint.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 int getFirstReadTimeout()
public void setFirstReadTimeout(int firstReadTimeout)
public void setDaemon(boolean b)
public boolean getDaemon()
public void setName(java.lang.String name)
public java.lang.String getName()
public void setUseComet(boolean useComet)
public boolean getUseComet()
public void setAcceptorThreadCount(int acceptorThreadCount)
public int getAcceptorThreadCount()
public void setPollerThreadCount(int pollerThreadCount)
public int getPollerThreadCount()
public void setSelectorTimeout(long timeout)
public long getSelectorTimeout()
public NioEndpoint.Poller getPoller0()
public NioEndpoint.Poller getCometPoller0()
public int getMaxSpareThreads()
public int getMinSpareThreads()
public void setProperty(java.lang.String name, java.lang.String value)
public java.lang.String getKeystoreFile()
public void setKeystoreFile(java.lang.String s)
public void setKeystore(java.lang.String s)
public java.lang.String getKeystore()
public java.lang.String getAlgorithm()
public void setAlgorithm(java.lang.String s)
public boolean getClientAuth()
public void setClientAuth(boolean b)
public java.lang.String getKeystorePass()
public void setKeystorePass(java.lang.String s)
public java.lang.String getKeystoreType()
public void setKeystoreType(java.lang.String s)
public java.lang.String getSslProtocol()
public void setSslProtocol(java.lang.String s)
public void setSslEnabledProtocols(java.lang.String s)
public java.lang.String getCiphers()
public void setCiphers(java.lang.String s)
public boolean isSSLEnabled()
public void setSSLEnabled(boolean SSLEnabled)
public boolean getSecure()
public void setSecure(boolean b)
public void setSelectorPool(NioSelectorPool selectorPool)
public void setSocketProperties(SocketProperties socketProperties)
public javax.net.ssl.SSLContext getSSLContext()
public void setSSLContext(javax.net.ssl.SSLContext c)
public int getKeepAliveCount()
public int getCurrentThreadCount()
public int getCurrentThreadsBusy()
public boolean isRunning()
public boolean isPaused()
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 int getSequence()
public int getWriteBufSize()
public int getReadBufSize()
public NioSelectorPool getSelectorPool()
public SocketProperties getSocketProperties()
protected void unlockAccept()
protected boolean setSocketOptions(java.nio.channels.SocketChannel socket)
protected javax.net.ssl.SSLEngine createSSLEngine()
protected NioEndpoint.Worker createWorkerThread()
null
instead.
protected NioEndpoint.Worker newWorkerThread()
protected NioEndpoint.Worker getWorkerThread()
protected void recycleWorkerThread(NioEndpoint.Worker workerThread)
workerThread
- The processor to be recycledprotected boolean processSocket(java.nio.channels.SocketChannel socket)
protected boolean processSocket(NioChannel socket)
protected boolean processSocket(NioChannel socket, SocketStatus status)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |