org.apache.tomcat.util.net
public class NioEndpoint extends Object
Nested Class Summary | |
---|---|
protected class | NioEndpoint.Acceptor
Server socket acceptor thread. |
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 AtomicInteger | activeSocketProcessors
Keep track of how many threads are in use |
protected InetAddress | address
Address for the server socket. |
protected String | algorithm |
protected int | backlog
Allows the server developer to specify the backlog that
should be used for server sockets. |
protected String | ciphers |
protected String[] | ciphersarr |
protected String | clientAuth |
protected int | curThreads
Current worker threads count. |
protected int | curThreadsBusy
Current worker threads busy count. |
static String | CERTIFICATE_KEY
The Request attribute key for the client certificate chain. |
static String | CIPHER_SUITE_KEY
The Request attribute key for the cipher suite. |
protected boolean | daemon
The default is true - the created threads will be
in daemon mode. |
protected ConcurrentLinkedQueue<NioEndpoint.PollerEvent> | eventCache
Cache for poller events |
protected 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. |
protected ConcurrentLinkedQueue<NioEndpoint.KeyAttachment> | keyCache
Cache for key attachment objects |
protected String | keystoreFile |
protected String | keystorePass |
protected String | keystoreType |
static String | KEY_SIZE_KEY
The Request attribute key for the key size. |
protected static Log | log |
protected int | maxThreads
Maximum amount of worker threads. |
protected String | name
Name of the thread pool, which will be used for naming child threads. |
protected 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 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 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 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 ServerSocketChannel | serverSock
Server socket "pointer". |
protected int | sessionCacheSize |
protected int | sessionCacheTimeout |
protected static StringManager | sm |
protected SocketProperties | socketProperties |
protected SSLContext | sslContext |
protected String | sslEnabledProtocols |
protected String[] | sslEnabledProtocolsarr |
protected String | sslProtocol |
protected CountDownLatch | stopLatch |
static String | SESSION_ID_KEY
The Request attribute key for the session id.
|
protected boolean | SSLEnabled
SSL engine. |
protected int | threadPriority
Priority of the worker threads. |
protected String | truststoreFile |
protected String | truststorePass |
protected String | truststoreType |
protected boolean | useComet
Allow comet request handling. |
protected boolean | useExecutor |
protected boolean | useSendfile
use send file |
protected NioEndpoint.WorkerStack | workers
Available workers. |
Method Summary | |
---|---|
String | adjustRelativePath(String path, String relativeTo) |
protected void | checkParachute() |
protected SSLEngine | createSSLEngine() |
protected NioEndpoint.Worker | createWorkerThread()
Create (or allocate) and return an available processor for use in
processing a specific HTTP request, if possible. |
String | defaultIfNull(String val, String defaultValue) |
void | destroy()
Deallocate NIO memory pools, and close server socket. |
int | getAcceptorThreadCount() |
int | getAcceptorThreadPriority() |
InetAddress | getAddress() |
String | getAlgorithm() |
int | getBacklog() |
String | getCiphers() |
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() |
Executor | getExecutor() |
NioEndpoint.Handler | getHandler() |
int | getKeepAliveCount()
Number of keepalive sockets. |
String | getKeyAlias() |
String | getKeystore() |
String | getKeystoreFile() |
String | getKeystorePass() |
String | getKeystoreType() |
int | getMaxSpareThreads()
Dummy maxSpareThreads property. |
int | getMaxThreads() |
int | getMinSpareThreads()
Dummy minSpareThreads property. |
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 | getSessionCacheTimeout() |
SocketProperties | getSocketProperties() |
int | getSoLinger()
Socket linger. |
int | getSoTimeout()
Socket timeout. |
String | getSslProtocol() |
SSLContext | getSSLContext() |
boolean | getTcpNoDelay()
Socket TCP no delay. |
int | getThreadPriority() |
String | getTruststoreFile() |
String | getTruststorePass() |
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(InetAddress address) |
void | setAlgorithm(String s) |
void | setBacklog(int backlog) |
void | setCiphers(String s) |
void | setClientAuth(String s) |
void | setDaemon(boolean b) |
void | setExecutor(Executor executor) |
void | setHandler(NioEndpoint.Handler handler) |
void | setKeyAlias(String s) |
void | setKeystore(String s) |
void | setKeystoreFile(String s) |
void | setKeystorePass(String s) |
void | setKeystoreType(String s) |
void | setMaxThreads(int maxThreads) |
void | setName(String name) |
void | setOomParachute(int oomParachute) |
void | setOomParachuteData(byte[] oomParachuteData) |
void | setPollerThreadCount(int pollerThreadCount) |
void | setPollerThreadPriority(int pollerThreadPriority) |
void | setPort(int port) |
boolean | setProperty(String name, String value)
Generic properties, introspected |
void | setSecure(boolean b) |
void | setSelectorPool(NioSelectorPool selectorPool) |
void | setSelectorTimeout(long timeout) |
void | setSessionCacheSize(int i) |
void | setSessionCacheTimeout(int i) |
protected boolean | setSocketOptions(SocketChannel socket)
Process the specified connection. |
void | setSocketProperties(SocketProperties socketProperties) |
void | setSoLinger(int soLinger) |
void | setSoTimeout(int soTimeout) |
void | setSslEnabledProtocols(String s) |
void | setSslProtocol(String s) |
void | setSSLContext(SSLContext c) |
void | setSSLEnabled(boolean SSLEnabled) |
void | setTcpNoDelay(boolean tcpNoDelay) |
void | setThreadPriority(int threadPriority) |
void | setTruststoreFile(String s) |
void | setTruststorePass(String truststorePass) |
void | setTruststoreType(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. |
KeyManager[] | wrap(KeyManager[] managers) |
null
instead.Returns: the amount of threads that are managed by the pool
Returns: the amount of threads that are in use
Returns:
Returns: true if the endpoint is paused, false otherwise
Returns: true if the endpoint is running, false otherwise
Returns: boolean
Parameters: workerThread The processor to be recycled