|
Apache Tomcat 6.0.53 | ||||||||
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.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 |
static class |
NioEndpoint.SendfileData
SendfileData class. |
protected class |
NioEndpoint.SocketProcessor
This class is the equivalent of the Worker, but will simply use in an external Executor thread pool. |
static class |
NioEndpoint.TaskQueue
|
protected class |
NioEndpoint.Worker
Server processor class. |
class |
NioEndpoint.WorkerStack
|
Field Summary | |
---|---|
protected int |
acceptorThreadCount
Acceptor thread count. |
protected int |
acceptorThreadPriority
Priority of the acceptor threads. |
protected java.util.concurrent.atomic.AtomicInteger |
activeSocketProcessors
Keep track of how many threads are in use |
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 java.lang.String |
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 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) |
protected int |
oomParachute
The size of the OOM parachute. |
protected byte[] |
oomParachuteData
The oom parachute, when an OOM error happens, will release the data, giving the JVM instantly a chunk of data to be able to recover with. |
protected static java.lang.String |
oomParachuteMsg
Make sure this string has already been allocated |
static int |
OP_CALLBACK
|
static int |
OP_REGISTER
|
protected boolean |
paused
Will be set to true whenever the endpoint is paused. |
protected java.util.concurrent.atomic.AtomicInteger |
pollerRotater
|
protected NioEndpoint.Poller[] |
pollers
The socket poller. |
protected int |
pollerThreadCount
Poller thread count. |
protected int |
pollerThreadPriority
Priority of the poller threads. |
protected int |
port
Server socket port. |
protected java.util.concurrent.ConcurrentLinkedQueue<NioEndpoint.SocketProcessor> |
processorCache
Cache for SocketProcessor objects |
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 int |
sessionCacheSize
|
protected int |
sessionTimeout
|
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 java.util.concurrent.CountDownLatch |
stopLatch
|
protected int |
threadPriority
Priority of the worker threads. |
protected java.lang.String |
truststoreFile
|
protected java.lang.String |
truststorePass
|
protected java.lang.String |
truststoreType
|
protected boolean |
useComet
Allow comet request handling. |
protected boolean |
useExecutor
|
protected boolean |
useSendfile
use send file |
protected NioEndpoint.WorkerStack |
workers
Available workers. |
Constructor Summary | |
---|---|
NioEndpoint()
|
Method Summary | |
---|---|
java.lang.String |
adjustRelativePath(java.lang.String path,
java.lang.String relativeTo)
|
protected void |
checkParachute()
|
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. |
java.lang.String |
defaultIfNull(java.lang.String val,
java.lang.String defaultValue)
|
void |
destroy()
Deallocate NIO memory pools, and close server socket. |
int |
getAcceptorThreadCount()
|
int |
getAcceptorThreadPriority()
|
java.net.InetAddress |
getAddress()
|
java.lang.String |
getAlgorithm()
|
int |
getBacklog()
|
java.lang.String |
getCiphers()
|
java.lang.String |
getClientAuth()
|
int |
getCurrentThreadCount()
Return the amount of threads that are managed by the pool. |
int |
getCurrentThreadsBusy()
Return the amount of threads that are in use |
boolean |
getDaemon()
|
java.util.concurrent.Executor |
getExecutor()
|
NioEndpoint.Handler |
getHandler()
|
int |
getKeepAliveCount()
Number of keepalive sockets. |
java.lang.String |
getKeyAlias()
|
java.lang.String |
getKeystore()
|
java.lang.String |
getKeystoreFile()
|
java.lang.String |
getKeystorePass()
|
java.lang.String |
getKeystoreType()
|
int |
getLocalPort()
Port in use. |
int |
getMaxSpareThreads()
Dummy maxSpareThreads property. |
int |
getMaxThreads()
|
int |
getMinSpareThreads()
Dummy minSpareThreads property. |
java.lang.String |
getName()
|
int |
getOomParachute()
|
byte[] |
getOomParachuteData()
|
NioEndpoint.Poller |
getPoller0()
Return an available poller in true round robin fashion |
int |
getPollerThreadCount()
|
int |
getPollerThreadPriority()
|
int |
getPort()
|
int |
getReadBufSize()
|
boolean |
getSecure()
|
NioSelectorPool |
getSelectorPool()
|
long |
getSelectorTimeout()
|
protected int |
getSequence()
Get a sequence number used for thread naming. |
int |
getSessionCacheSize()
|
int |
getSessionTimeout()
|
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()
|
java.lang.String |
getTruststoreFile()
|
java.lang.String |
getTruststorePass()
|
java.lang.String |
getTruststoreType()
|
boolean |
getUseComet()
|
boolean |
getUseExecutor()
|
boolean |
getUseSendfile()
|
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 boolean |
isWorkerAvailable()
Returns true if a worker thread is available for processing. |
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(NioChannel socket,
SocketStatus status,
boolean dispatch)
|
protected boolean |
reclaimParachute(boolean force)
|
protected void |
recycleWorkerThread(NioEndpoint.Worker workerThread)
Recycle the specified Processor so that it can be used again. |
protected void |
releaseCaches()
|
void |
resume()
Resume the endpoint, which will make it start accepting new sockets again. |
void |
setAcceptorThreadCount(int acceptorThreadCount)
|
void |
setAcceptorThreadPriority(int acceptorThreadPriority)
|
void |
setAddress(java.net.InetAddress address)
|
void |
setAlgorithm(java.lang.String s)
|
void |
setBacklog(int backlog)
|
void |
setCiphers(java.lang.String s)
|
void |
setClientAuth(java.lang.String s)
|
void |
setDaemon(boolean b)
|
void |
setExecutor(java.util.concurrent.Executor executor)
|
void |
setHandler(NioEndpoint.Handler handler)
|
void |
setKeyAlias(java.lang.String s)
|
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 |
setOomParachute(int oomParachute)
|
void |
setOomParachuteData(byte[] oomParachuteData)
|
void |
setPollerThreadCount(int pollerThreadCount)
|
void |
setPollerThreadPriority(int pollerThreadPriority)
|
void |
setPort(int port)
|
boolean |
setProperty(java.lang.String name,
java.lang.String value)
Generic properties, introspected |
void |
setSecure(boolean b)
|
void |
setSelectorPool(NioSelectorPool selectorPool)
|
void |
setSelectorTimeout(long timeout)
|
void |
setSessionCacheSize(int i)
|
void |
setSessionTimeout(int i)
|
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 |
setTruststoreFile(java.lang.String s)
|
void |
setTruststorePass(java.lang.String truststorePass)
|
void |
setTruststoreType(java.lang.String truststoreType)
|
void |
setUseComet(boolean useComet)
|
void |
setUseExecutor(boolean useexec)
|
void |
setUseSendfile(boolean useSendfile)
|
void |
start()
Start the NIO endpoint, creating acceptor, poller threads. |
void |
stop()
Stop the endpoint. |
protected void |
unlockAccept()
Unlock the server socket accept using a bogus connection. |
javax.net.ssl.KeyManager[] |
wrap(javax.net.ssl.KeyManager[] managers)
|
Methods inherited from class org.apache.tomcat.util.net.AbstractEndpoint |
---|
getMaxHeaderCount, setMaxHeaderCount |
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
public static final int OP_CALLBACK
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 boolean useSendfile
protected int oomParachute
protected byte[] oomParachuteData
protected static final java.lang.String oomParachuteMsg
protected java.util.concurrent.atomic.AtomicInteger activeSocketProcessors
protected volatile java.util.concurrent.CountDownLatch stopLatch
protected java.util.concurrent.ConcurrentLinkedQueue<NioEndpoint.SocketProcessor> processorCache
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 boolean useExecutor
protected int maxThreads
protected int threadPriority
protected int acceptorThreadPriority
protected int pollerThreadPriority
protected int port
protected java.net.InetAddress address
protected NioEndpoint.Handler handler
protected int backlog
protected SocketProperties socketProperties
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 java.util.concurrent.atomic.AtomicInteger pollerRotater
protected java.lang.String truststoreFile
protected java.lang.String truststorePass
protected java.lang.String truststoreType
protected java.lang.String keystoreFile
protected java.lang.String algorithm
protected java.lang.String 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 int sessionCacheSize
protected int sessionTimeout
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 setUseExecutor(boolean useexec)
public boolean getUseExecutor()
public void setMaxThreads(int maxThreads)
public int getMaxThreads()
public void setThreadPriority(int threadPriority)
public int getThreadPriority()
public void setAcceptorThreadPriority(int acceptorThreadPriority)
public int getAcceptorThreadPriority()
public void setPollerThreadPriority(int pollerThreadPriority)
public int getPollerThreadPriority()
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 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 int getMaxSpareThreads()
public int getMinSpareThreads()
public boolean setProperty(java.lang.String name, java.lang.String value)
public java.lang.String adjustRelativePath(java.lang.String path, java.lang.String relativeTo)
public java.lang.String defaultIfNull(java.lang.String val, java.lang.String defaultValue)
public void setTruststoreFile(java.lang.String s)
public java.lang.String getTruststoreFile()
public void setTruststorePass(java.lang.String truststorePass)
public java.lang.String getTruststorePass()
public void setTruststoreType(java.lang.String truststoreType)
public java.lang.String getTruststoreType()
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 getKeyAlias()
public void setKeyAlias(java.lang.String s)
public java.lang.String getAlgorithm()
public void setAlgorithm(java.lang.String s)
public java.lang.String getClientAuth()
public void setClientAuth(java.lang.String s)
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 int getSessionCacheSize()
public void setSessionCacheSize(int i)
public int getSessionTimeout()
public void setSessionTimeout(int i)
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 void setUseSendfile(boolean useSendfile)
public void setOomParachute(int oomParachute)
public void setOomParachuteData(byte[] oomParachuteData)
public javax.net.ssl.SSLContext getSSLContext()
public void setSSLContext(javax.net.ssl.SSLContext c)
public int getLocalPort()
getLocalPort
in class AbstractEndpoint
protected void checkParachute()
protected boolean reclaimParachute(boolean force)
protected void releaseCaches()
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 javax.net.ssl.KeyManager[] wrap(javax.net.ssl.KeyManager[] managers)
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()
public boolean getUseSendfile()
public int getOomParachute()
public byte[] getOomParachuteData()
protected void unlockAccept()
protected boolean setSocketOptions(java.nio.channels.SocketChannel socket)
protected javax.net.ssl.SSLEngine createSSLEngine()
protected boolean isWorkerAvailable()
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(NioChannel socket)
protected boolean processSocket(NioChannel socket, SocketStatus status)
protected boolean processSocket(NioChannel socket, SocketStatus status, boolean dispatch)
|
Apache Tomcat 6.0.53 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |