|
Apache Tomcat 7.0.2 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.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. |
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 ConcurrentLinkedQueue<NioEndpoint.PollerEvent> |
eventCache
Cache for poller events |
protected NioEndpoint.Handler |
handler
Handling of accepted sockets. |
protected ConcurrentLinkedQueue<NioEndpoint.KeyAttachment> |
keyCache
Cache for key attachment objects |
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 AtomicInteger |
pollerRotater
|
protected NioEndpoint.Poller[] |
pollers
The socket poller. |
protected int |
pollerThreadCount
Poller thread count. |
protected int |
pollerThreadPriority
Priority of the poller threads. |
protected ConcurrentLinkedQueue<NioEndpoint.SocketProcessor> |
processorCache
Cache for SocketProcessor objects |
protected NioSelectorPool |
selectorPool
|
protected long |
selectorTimeout
|
protected ServerSocketChannel |
serverSock
Server socket "pointer". |
protected SSLContext |
sslContext
|
protected CountDownLatch |
stopLatch
|
protected boolean |
useComet
Allow comet request handling. |
protected boolean |
useSendfile
use send file |
Constructor Summary | |
---|---|
NioEndpoint()
|
Method Summary | |
---|---|
protected void |
checkParachute()
|
protected SSLEngine |
createSSLEngine()
|
void |
destroy()
Deallocate NIO memory pools, and close server socket. |
int |
getAcceptorThreadCount()
|
int |
getAcceptorThreadPriority()
|
NioEndpoint.Handler |
getHandler()
|
int |
getKeepAliveCount()
Number of keepalive sockets. |
int |
getOomParachute()
|
byte[] |
getOomParachuteData()
|
NioEndpoint.Poller |
getPoller0()
Return an available poller in true round robin fashion |
int |
getPollerThreadCount()
|
int |
getPollerThreadPriority()
|
int |
getReadBufSize()
|
NioSelectorPool |
getSelectorPool()
|
long |
getSelectorTimeout()
|
SSLContext |
getSSLContext()
|
boolean |
getUseComet()
|
boolean |
getUseSendfile()
|
int |
getWriteBufSize()
|
void |
init()
Initialize the endpoint. |
boolean |
isPaused()
Return the state of the endpoint. |
boolean |
isRunning()
Return the state of the endpoint. |
protected boolean |
isWorkerAvailable()
Returns true if a worker thread is available for processing. |
void |
pause()
Pause the endpoint, which will make it stop accepting new sockets. |
boolean |
processSocket(NioChannel socket,
SocketStatus status,
boolean dispatch)
|
protected boolean |
reclaimParachute(boolean force)
|
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 |
setHandler(NioEndpoint.Handler handler)
|
void |
setOomParachute(int oomParachute)
|
void |
setOomParachuteData(byte[] oomParachuteData)
|
void |
setPollerThreadCount(int pollerThreadCount)
|
void |
setPollerThreadPriority(int pollerThreadPriority)
|
boolean |
setProperty(String name,
String value)
Generic properties, introspected |
void |
setSelectorPool(NioSelectorPool selectorPool)
|
void |
setSelectorTimeout(long timeout)
|
protected boolean |
setSocketOptions(SocketChannel socket)
Process the specified connection. |
void |
setSocketProperties(SocketProperties socketProperties)
|
void |
setSSLContext(SSLContext c)
|
void |
setUseComet(boolean useComet)
|
void |
setUseSendfile(boolean useSendfile)
|
void |
start()
Start the NIO endpoint, creating acceptor, poller threads. |
void |
stop()
Stop the endpoint. |
KeyManager[] |
wrap(KeyManager[] managers)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int OP_REGISTER
public static final int OP_CALLBACK
protected NioSelectorPool selectorPool
protected ServerSocketChannel serverSock
protected boolean useSendfile
protected int oomParachute
protected byte[] oomParachuteData
protected static final String oomParachuteMsg
protected AtomicInteger activeSocketProcessors
protected volatile CountDownLatch stopLatch
protected ConcurrentLinkedQueue<NioEndpoint.SocketProcessor> processorCache
protected ConcurrentLinkedQueue<NioEndpoint.KeyAttachment> keyCache
protected ConcurrentLinkedQueue<NioEndpoint.PollerEvent> eventCache
protected ConcurrentLinkedQueue<NioChannel> nioChannels
protected int acceptorThreadPriority
protected int pollerThreadPriority
protected NioEndpoint.Handler handler
protected boolean useComet
protected int acceptorThreadCount
protected int pollerThreadCount
protected long selectorTimeout
protected NioEndpoint.Poller[] pollers
protected AtomicInteger pollerRotater
protected SSLContext sslContext
Constructor Detail |
---|
public NioEndpoint()
Method Detail |
---|
public boolean setProperty(String name, String value)
setProperty
in class AbstractEndpoint
public void setAcceptorThreadPriority(int acceptorThreadPriority)
public int getAcceptorThreadPriority()
public void setPollerThreadPriority(int pollerThreadPriority)
public int getPollerThreadPriority()
public void setHandler(NioEndpoint.Handler handler)
public NioEndpoint.Handler getHandler()
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 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 SSLContext getSSLContext()
public void setSSLContext(SSLContext c)
protected void checkParachute()
protected boolean reclaimParachute(boolean force)
protected void releaseCaches()
public int getKeepAliveCount()
public boolean isRunning()
isRunning
in class AbstractEndpoint
public boolean isPaused()
isPaused
in class AbstractEndpoint
public void init() throws Exception
init
in class AbstractEndpoint
Exception
public KeyManager[] wrap(KeyManager[] managers)
public void start() throws Exception
start
in class AbstractEndpoint
Exception
public void pause()
pause
in class AbstractEndpoint
public void resume()
resume
in class AbstractEndpoint
public void stop()
public void destroy() throws Exception
destroy
in class AbstractEndpoint
Exception
public int getWriteBufSize()
public int getReadBufSize()
public NioSelectorPool getSelectorPool()
public boolean getUseSendfile()
public int getOomParachute()
public byte[] getOomParachuteData()
protected boolean setSocketOptions(SocketChannel socket)
protected SSLEngine createSSLEngine()
protected boolean isWorkerAvailable()
public boolean processSocket(NioChannel socket, SocketStatus status, boolean dispatch)
|
Apache Tomcat 7.0.2 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |