|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.lang.Thread
com.sun.enterprise.web.connector.grizzly.SelectorThread
public class SelectorThread
This class implement an NIO socket HTTP Listener. This class supports three stagegy: Mode Blocking: This mode uses NIO blocking mode, and doesn't uses any of the java.nio.* classes. Mode Non-Blocking: This mode uses NIO non blocking mode and read the entire request stream before processing the request. The stragegy used is to find the content-lenght header and buffer bytes until the end of the stream is read.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class java.lang.Thread |
|---|
Thread.State, Thread.UncaughtExceptionHandler |
| Field Summary | |
|---|---|
protected Queue<ProcessorTask> |
activeProcessorTasks
List of active ProcessorTask. |
protected Adapter |
adapter
Associated adapter. |
protected Class |
algorithmClass
The Algorithm used to predict the end of the NIO stream |
protected String |
algorithmClassName
The Algorithm used to parse the NIO stream. |
protected boolean |
asyncExecution
Is asynchronous mode enabled? |
protected AsyncHandler |
asyncHandler
When the asynchronous mode is enabled, the execution of this object will be delegated to the AsyncHandler |
protected Queue<SelectionKey> |
bannedKeys
Banned SelectionKey registration. |
protected boolean |
bufferResponse
Buffer the response until the buffer is full. |
protected String |
compressableMimeTypes
|
protected String |
compression
Compression value. |
protected int |
compressionMinSize
|
protected int |
currentConnectionNumber
The current number of simulatenous connection. |
static String |
DEFAULT_ALGORITHM
The default NIO stream algorithm. |
protected static boolean |
defaultAlgorithmInstalled
Is the DEFAULT_ALGORITHM used. |
protected String |
defaultResponseType
The default response-type |
protected boolean |
disableUploadTimeout
Flag to disable setting a different time-out on uploads. |
protected boolean |
displayConfiguration
If true, display the NIO configuration information. |
protected String |
domain
|
protected boolean |
enableNioLogging
Grizzly own debug flag. |
protected FileCacheFactory |
fileCacheFactory
The FileCacheFactory associated with this Selector |
protected String |
forcedRequestType
The forced request-type |
protected RequestGroupInfo |
globalRequestProcessor
Monitoring object used to store information. |
protected ObjectName |
globalRequestProcessorName
|
protected InetAddress |
inet
|
protected boolean |
initialized
|
protected boolean |
isFileCacheEnabled
Is the FileCache enabled. |
protected boolean |
isLargeFileCacheEnabled
Is the large FileCache enabled. |
protected boolean |
isMonitoringEnabled
Is monitoring already started. |
protected boolean |
isWaiting
Is this Selector currently in Wating mode? |
protected KeepAlivePipeline |
keepAlivePipeline
Keep-Alive subsystem. |
protected int |
keepAliveTimeoutInSeconds
|
protected int |
linger
|
protected static Logger |
logger
The logger used by the grizzly classes. |
protected int |
maxCacheEntries
The maximum entries in the fileCache |
protected long |
maxEntrySize
The maximum size of a cached resources. |
protected int |
maxHttpHeaderSize
Default HTTP header buffer size. |
protected int |
maxKeepAliveRequests
|
protected long |
maxLargeFileCacheSize
The maximum cached bytes |
protected int |
maxPostSize
|
protected int |
maxProcessorWorkerThreads
Maximum number of WorkerThread |
protected int |
maxQueueSizeInBytes
Maximum pending connection before refusing requests. |
protected int |
maxReadWorkerThreads
Maximum number of ReadWorkerThread |
protected int |
maxSelectors
Maximum number of Selectors in the SelectorFactory pool |
protected long |
maxSmallFileCacheSize
The maximum cached bytes |
protected long |
minEntrySize
The maximum size of a cached resources. |
protected int |
minProcessorQueueLength
Number of polled ProcessorTask instance. |
protected int |
minReadQueueLength
Number of polled Read*Task instance. |
protected int |
minSpareThreads
Minimum numbers of WorkerThread
before creating new thread. |
protected int |
minWorkerThreads
Minimum numbers of WorkerThread created |
protected MBeanServer |
mserver
|
protected int |
multiSelectorsCount
The number of SelectorReadThread |
protected String |
noCompressionUserAgents
|
protected ObjectName |
oname
|
protected boolean |
oOBInline
|
protected String |
pipelineClassName
The default Pipeline used. |
protected PipelineStatistic |
pipelineStat
Placeholder for Pipeline statistic. |
protected int |
port
|
protected Pipeline |
processorPipeline
The queue shared by this thread and the code>ProcessorTask. |
protected Queue<ProcessorTask> |
processorTasks
ConcurrentLinkedQueue used as an object pool. |
protected ObjectName |
processorWorkerThreadName
|
protected Pipeline |
readPipeline
The queue shared by this thread and code>ReadTask |
protected Queue<ReadTask> |
readTasks
ConcurrentLinkedQueue used as an object pool. |
protected MultiSelectorThread[] |
readThreads
The Selector used to register OP_READ |
protected boolean |
recycleTasks
Recycle the Task after running them |
protected int |
requestBufferSize
The input request buffer size. |
protected String |
restrictedUserAgents
|
protected static String |
rootFolder
The root folder where application are deployed |
protected boolean |
running
|
protected int |
secondsMaxAge
Timeout before remove the static resource from the cache. |
protected Selector |
selector
The Selector used by the connector. |
protected static int |
selectorTimeout
The Selector timeout value. |
static String |
SERVER_NAME
|
protected ServerSocket |
serverSocket
|
protected ServerSocketChannel |
serverSocketChannel
The ServerSocketChannel used in blocking mode. |
protected int |
serverTimeout
|
protected boolean |
socketKeepAlive
|
protected int |
socketReceiveBufferSize
|
protected int |
socketSendBufferSize
|
protected int |
socketTimeout
|
protected int |
ssBackLog
Server socket backlog. |
protected boolean |
tcpNoDelay
|
protected int |
threadsIncrement
The number used when increamenting the Pipeline
thread pool. |
protected int |
threadsTimeout
The timeout used by the thread when processing a request. |
protected int |
uploadTimeout
Maximum timeout on uploads. |
protected boolean |
useByteBufferView
Create view ByteBuffer from another ByteBuffer |
protected boolean |
useDirectByteBuffer
Is the ByteBuffer used by the ReadTask use
direct ByteBuffer or not. |
| Fields inherited from class java.lang.Thread |
|---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
| Constructor Summary | |
|---|---|
SelectorThread()
Create the Selector object. |
|
| Method Summary | |
|---|---|
void |
addBannedSelectionKey(SelectionKey key)
Add a SelectionKey to the banned list of SelectionKeys. |
void |
cancelKey(SelectionKey key)
Cancel the current SelectionKey |
boolean |
cancelThreadExecution(long cancelThreadID)
Cancel the threadID execution. |
protected void |
clearTasks()
Clear all cached Tasks |
protected void |
configureCompression(DefaultProcessorTask processorTask)
|
protected ProcessorTask |
configureProcessorTask(DefaultProcessorTask task)
|
protected void |
configureReadThread(SelectorThread multiSelector)
|
void |
disableMonitoring()
Disable gathering of monitoring datas. |
protected void |
disablePipelineStats()
Removes PipelineStatistic from every
Pipeline, when monitoring has been turned off. |
protected void |
doSelect()
Execute a Selector.select() operation. |
void |
enableCometSupport(boolean enableComet)
Enable Comet/Poll request support. |
void |
enableMonitoring()
Enable gathering of monitoring datas. |
protected void |
enablePipelineStats()
Injects PipelineStatistic into every
Pipeline, for monitoring purposes. |
void |
enableRcmSupport(boolean rcmSupport)
Enable Application Resource Allocation Grizzly Extension. |
void |
enableSelectionKeys()
Enable all registered interestOps. |
protected void |
expireIdleKeys()
Cancel keep-alive connections. |
Queue<ProcessorTask> |
getActiveProcessorTasks()
|
Adapter |
getAdapter()
Get the associated adapter. |
InetAddress |
getAddress()
|
Class |
getAlgorithmClass()
|
String |
getAlgorithmClassName()
|
AsyncHandler |
getAsyncHandler()
Return the AsyncHandler used when asynchronous execution is
enabled. |
boolean |
getBufferResponse()
Return true if the reponse is buffered. |
int |
getBufferSize()
Return the request input buffer size |
ClassLoader |
getClassLoader()
|
String |
getCompressableMimeTypes()
|
String |
getCompression()
|
int |
getCompressionMinSize()
|
int |
getCountThreadsIdleStats()
|
int |
getCountThreadsStats()
PWCThreadPool Stats |
int |
getCurReadThread()
|
int |
getCurrentBusyProcessorThreads()
Provides the count of request threads that are currently being processed by the container |
int |
getCurrentConnectionNumber()
|
int |
getCurrentThreadCountStats()
HTTPListener Stats |
int |
getCurrentThreadsBusyStats()
|
String |
getDefaultResponseType()
|
boolean |
getDisableUploadTimeout()
Get the flag that controls upload time-outs. |
String |
getDomain()
|
boolean |
getEnableAsyncExecution()
Return true when asynchronous execution is enabled. |
String |
getForcedRequestType()
|
RequestGroupInfo |
getGlobalRequestProcessor()
|
ObjectName |
getGlobalRequestProcessorName()
|
InetAddress |
getInet()
|
int |
getKaTimeout()
|
ObjectName |
getKeepAliveMbeanName()
|
KeepAlivePipeline |
getKeepAlivePipeline()
|
KeepAliveStats |
getKeepAliveStats()
|
int |
getKeepAliveTimeoutInSeconds()
Gets the number of seconds before a keep-alive connection that has been idle times out and is closed. |
Queue<SelectionKey> |
getKeysToEnable()
|
boolean |
getLargeFileCacheEnabled()
Is the large file cache support enabled. |
int |
getLinger()
|
static Logger |
getLogger()
|
Management |
getManagement()
|
int |
getMaxCacheEntries()
Return the maximum entries this cache can contains. |
long |
getMaxEntrySize()
Get the maximum size a FileCacheEntry can have. |
int |
getMaxHttpHeaderSize()
|
int |
getMaxKeepAliveRequests()
|
long |
getMaxLargeCacheSize()
Get the maximum cache size |
int |
getMaxPostSize()
|
int |
getMaxProcessorWorkerThreads()
|
int |
getMaxQueueSizeInBytes()
|
int |
getMaxReadWorkerThreads()
|
int |
getMaxSelectors()
|
long |
getMaxSmallCacheSize()
Get the maximum cache size |
int |
getMaxSpareThreads()
|
int |
getMaxSpareThreadsStats()
|
int |
getMaxThreads()
|
int |
getMaxThreadsStats()
|
long |
getMinEntrySize()
Get the maximum size a FileCacheEntry can have. |
int |
getMinProcessorQueueLength()
|
int |
getMinReadQueueLength()
|
int |
getMinSpareThreads()
|
int |
getMinSpareThreadsStats()
|
int |
getMinWorkerThreads()
|
MBeanServer |
getMserver()
|
long |
getNextKeysExpiration()
|
String |
getNoCompressionUserAgents()
|
ObjectName |
getObjectName()
|
ObjectName |
getOname()
|
String |
getPipelineClassName()
|
PipelineStatistic |
getPipelineStat()
|
int |
getPort()
|
int |
getPortLowLevel()
Use the method to get the actual port which is different from the requested port in case port 0 was requested. |
Pipeline |
getProcessorPipeline()
|
ProcessorTask |
getProcessorTask()
Return a ProcessorTask from the pool. |
Queue<ProcessorTask> |
getProcessorTasks()
|
ObjectName |
getProcessorWorkerThreadName()
|
ObjectName |
getPwcConnectionQueueMbeanName()
|
ObjectName |
getPwcFileCacheMbeanName()
|
int |
getQueueSizeInBytes()
Get the maximum pending connection this Pipeline
can handle. |
Pipeline |
getReadPipeline()
Return the Pipeline used to handle OP_READ. |
ReadTask |
getReadTask(SelectionKey key)
Return a ReadTask from the pool. |
Queue<ReadTask> |
getReadTasks()
|
RequestGroupInfo |
getRequestGroupInfo()
|
String |
getRestrictedUserAgents()
|
boolean |
getReuseAddress()
|
static String |
getRootFolder()
|
Selector |
getSelector()
|
static SelectorThread |
getSelector(int port)
Return the SelectorThread which listen on port, or null
if there is no SelectorThread. |
int |
getSelectorReadThreadsCount()
|
static Enumeration<SelectorThread> |
getSelectors()
Return an Enumeration of the active
SelectorThreads |
static int |
getSelectorTimeout()
|
ServerSocket |
getServerSocket()
|
ServerSocketChannel |
getServerSocketChannel()
|
int |
getServerSoTimeout()
|
int |
getServerTimeout()
|
int |
getSocketReceiveBufferSize()
|
int |
getSocketSendBufferSize()
|
int |
getSocketTimeout()
|
int |
getSoLinger()
|
int |
getSoTimeout()
|
int |
getSpinRate()
|
int |
getSsBackLog()
|
boolean |
getTcpNoDelay()
|
int |
getThreadsIncrement()
|
int |
getThreadsTimeout()
|
int |
getTimeout()
Get the upload timeout. |
int |
getTransactionTimeout()
Set the maximum time, in milliseconds, a WorkerThread executing
an instance of this class can execute. |
static String |
getWebAppRootPath()
Return the folder's root where application are deployed. |
protected void |
handleAccept(SelectionKey key)
Handle OP_ACCEPT |
protected void |
handleConnection(SelectionKey key)
Handle an incoming operation on the channel. |
protected ReadTask |
handleRead(SelectionKey key)
Handle OP_READ |
protected void |
initAlgorithm()
Load using reflection the Algorithm class. |
void |
initEndpoint()
initialized the endpoint by creating the ServerScoketChannel
and by initializing the server socket. |
protected void |
initFileCacheFactory()
Initialize the fileCacheFactory associated with this instance |
protected void |
initKeepAlivePipeline()
Initialize the keep-alive mechanism. |
protected void |
initMonitoringLevel()
|
protected void |
initMultiSelectors()
Initialize SelectorReadThread used to process
OP_READ operations. |
protected void |
initPipeline()
Init the Pipelines used by the WorkerThreads. |
protected void |
initProcessorTask(int size)
Create a pool of ProcessorTask |
protected void |
initReadTask(int size)
Create a pool of ReadTask |
boolean |
isBufferResponse()
|
boolean |
isDisplayConfiguration()
|
boolean |
isEnableNioLogging()
|
boolean |
isFileCacheEnabled()
Is the fileCache enabled. |
boolean |
isInitialized()
|
boolean |
isIsMonitoringEnabled()
|
boolean |
isMonitoringEnabled()
Returns true if monitoring has been enabled,
false otherwise. |
boolean |
isRecycleTasks()
|
boolean |
isRunning()
|
boolean |
isSocketKeepAlive()
|
boolean |
isTcpNoDelay()
|
boolean |
isUseByteBufferView()
|
boolean |
isUseDirectByteBuffer()
|
static Logger |
logger()
Return the logger used by the Grizzly classes. |
protected Pipeline |
newPipeline(int maxThreads,
int minThreads,
String name,
int port,
int priority)
Create a new Pipeline instance using the
pipelineClassName value. |
protected ProcessorTask |
newProcessorTask(boolean initialize)
Create ProcessorTask objects and configure it to be ready
to proceed request. |
protected ReadTask |
newReadTask()
Return a new ReadTask instance |
void |
postDeregister()
|
void |
postRegister(Boolean registrationDone)
|
void |
preDeregister()
|
ObjectName |
preRegister(MBeanServer server,
ObjectName name)
|
protected void |
rampUpProcessorTask()
Initialize ProcessorTask |
protected void |
reconfigureAsyncExecution()
Reconfigure Grizzly Asynchronous Request Processing(ARP) internal objects. |
protected void |
registerComponents()
Register JMX components. |
void |
registerKey(SelectionKey key)
Register a SelectionKey to this Selector
running of this thread. |
void |
removeCacheEntry(String contextPath)
Remove a context path from the FileCache. |
void |
resetSpinCounter()
|
void |
returnTask(Task task)
Returns the Task object to the pool. |
void |
run()
Start the endpoint (this) |
void |
setActiveProcessorTasks(Queue<ProcessorTask> activeProcessorTasks)
|
void |
setAdapter(Adapter adapter)
Set the associated adapter. |
void |
setAddress(InetAddress inet)
|
void |
setAlgorithmClass(Class algorithmClass)
|
void |
setAlgorithmClassName(String algorithmClassName)
|
void |
setAsyncHandler(AsyncHandler asyncHandler)
Set the AsyncHandler used when asynchronous execution is
enabled. |
void |
setBufferResponse(boolean bufferResponse)
trueif the reponse willk be buffered. |
void |
setBufferSize(int requestBufferSize)
Set the request input buffer size |
void |
setClassLoader(ClassLoader classLoader)
Set the ClassLoader used to load configurable
classes (Pipeline, StreamAlgorithm). |
void |
setCompressableMimeTypes(String compressableMimeTypes)
|
void |
setCompression(String compression)
|
void |
setCompressionMinSize(int compressionMinSize)
|
void |
setCurReadThread(int curReadThread)
|
void |
setCurrentConnectionNumber(int currentConnectionNumber)
|
void |
setDefaultResponseType(String defaultResponseType)
|
void |
setDisableUploadTimeout(boolean isDisabled)
Set the flag to control upload time-outs. |
void |
setDisplayConfiguration(boolean displayConfiguration)
|
void |
setDomain(String domain)
|
void |
setEnableAsyncExecution(boolean asyncExecution)
Enable the AsyncHandler used when asynchronous |
void |
setEnableNioLogging(boolean enableNioLogging)
|
void |
setFileCacheIsEnabled(boolean isFileCacheEnabled)
Is the file caching mechanism enabled. |
void |
setForcedRequestType(String forcedRequestType)
|
void |
setGlobalRequestProcessor(RequestGroupInfo globalRequestProcessor)
|
void |
setGlobalRequestProcessorName(ObjectName globalRequestProcessorName)
|
void |
setInet(InetAddress inet)
|
void |
setInitialized(boolean initialized)
|
void |
setIsMonitoringEnabled(boolean isMonitoringEnabled)
|
void |
setIsWaiting(boolean isWaiting)
|
void |
setKaTimeout(int kaTimeout)
|
void |
setKeepAliveMbeanName(ObjectName keepAliveMbeanName)
|
void |
setKeepAlivePipeline(KeepAlivePipeline keepAlivePipeline)
|
void |
setKeepAliveStats(KeepAliveStats keepAliveStats)
|
void |
setKeepAliveThreadCount(int threadCount)
Sets the number of keep-alive threads. |
void |
setKeepAliveTimeoutInSeconds(int timeout)
Sets the number of seconds before a keep-alive connection that has been idle times out and is closed. |
void |
setKeysToEnable(Queue<SelectionKey> keysToEnable)
|
void |
setLargeFileCacheEnabled(boolean isLargeEnabled)
Is the large file cache support enabled. |
void |
setLinger(int linger)
|
static void |
setLogger(Logger l)
Set the logger used by this instance. |
void |
setManagement(Management jmxManagement)
|
void |
setMaxCacheEntries(int mEntries)
Set the maximum entries this cache can contains. |
void |
setMaxEntrySize(long mEntrySize)
Set the maximum size a FileCacheEntry can have. |
void |
setMaxHttpHeaderSize(int maxHttpHeaderSize)
|
void |
setMaxKeepAliveRequests(int mkar)
Set the maximum number of Keep-Alive requests that we will honor. |
void |
setMaxLargeCacheSize(long mCacheSize)
Set the maximum cache size |
void |
setMaxPostSize(int maxPostSize)
|
void |
setMaxProcessorWorkerThreads(int maxProcessorWorkerThreads)
|
void |
setMaxQueueSizeInBytes(int maxQueueSizeInBytes)
|
void |
setMaxReadWorkerThreads(int maxReadWorkerThreads)
|
void |
setMaxSelectors(int maxSelectors)
|
void |
setMaxSmallCacheSize(long mCacheSize)
Set the maximum cache size |
void |
setMaxSpareThreads(int maxThreads)
|
void |
setMaxThreads(int maxThreads)
|
void |
setMinEntrySize(long mSize)
Set the maximum size a FileCacheEntry can have. |
void |
setMinProcessorQueueLength(int minProcessorQueueLength)
|
void |
setMinReadQueueLength(int minReadQueueLength)
|
void |
setMinSpareThreads(int minSpareThreads)
|
void |
setMinThreads(int minWorkerThreads)
The minimun threads created at startup. |
void |
setMinWorkerThreads(int minWorkerThreads)
|
void |
setMserver(MBeanServer mserver)
|
void |
setNextKeysExpiration(long nextKeysExpiration)
|
void |
setNoCompressionUserAgents(String noCompressionUserAgents)
|
void |
setOname(ObjectName oname)
|
void |
setPipelineClassName(String pipelineClassName)
|
void |
setPipelineStat(PipelineStatistic pipelineStat)
|
void |
setPort(int port)
|
void |
setProcessorPipeline(Pipeline processorPipeline)
|
void |
setProcessorTasks(Queue<ProcessorTask> processorTasks)
|
void |
setProcessorWorkerThreadName(ObjectName processorWorkerThreadName)
|
void |
setPwcConnectionQueueMbeanName(ObjectName pwcConnectionQueueMbeanName)
|
void |
setPwcFileCacheMbeanName(ObjectName pwcFileCacheMbeanName)
|
void |
setReadPipeline(Pipeline readPipeline)
|
void |
setReadTasks(Queue<ReadTask> readTasks)
|
void |
setRecycleTasks(boolean recycleTasks)
|
void |
setRestrictedUserAgents(String restrictedUserAgents)
|
void |
setReuseAddress(boolean reuseAddress)
|
static void |
setRootFolder(String aRootFolder)
|
void |
setRunning(boolean running)
|
void |
setSecondsMaxAge(int sMaxAges)
The timeout in seconds before remove a FileCacheEntry
from the fileCache |
void |
setSelector(Selector selector)
|
void |
setSelectorReadThreadsCount(int multiSelectorsCount)
|
static void |
setSelectorTimeout(int aSelectorTimeout)
|
void |
setServerSocket(ServerSocket serverSocket)
|
void |
setServerSocketChannel(ServerSocketChannel serverSocketChannel)
|
void |
setServerSoTimeout(int i)
|
void |
setServerTimeout(int timeout)
Sets the timeout in ms of the server sockets created by this server. |
void |
setSocketKeepAlive(boolean socketKeepAlive)
|
protected void |
setSocketOptions(Socket socket)
|
void |
setSocketReceiveBufferSize(int socketReceiveBufferSize)
|
void |
setSocketSendBufferSize(int socketSendBufferSize)
|
void |
setSocketTimeout(int socketTimeout)
|
void |
setSoLinger(int i)
|
void |
setSoTimeout(int i)
|
void |
setSsBackLog(int ssBackLog)
|
void |
setTcpNoDelay(boolean b)
|
void |
setThreadsIncrement(int threadsIncrement)
|
void |
setThreadsTimeout(int threadsTimeout)
|
void |
setTransactionTimeout(int transactionTimeout)
Set the maximum time, in milliseconds, a WrokerThread processing
an instance of this class. |
void |
setUploadTimeout(int uploadTimeout)
Set the upload timeout. |
void |
setUseByteBufferView(boolean useByteBufferView)
|
void |
setUseDirectByteBuffer(boolean useDirectByteBuffer)
|
static void |
setWebAppRootPath(String rf)
Set the document root folder |
void |
startEndpoint()
Start the Acceptor Thread and wait for incoming connection, in a non blocking mode. |
protected void |
startListener()
Start a non blocking Selector object. |
protected void |
startPipelines()
Starts the Pipeline used by this Selector |
void |
stopEndpoint()
|
protected void |
stopPipelines()
Stop the Pipeline used by this Selector |
protected void |
unregisterComponents()
Unregister components. |
void |
wakeup()
Wakes up the Selector associated with this thread. |
| Methods inherited from class java.lang.Thread |
|---|
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final String SERVER_NAME
protected int serverTimeout
protected InetAddress inet
protected int port
protected ServerSocket serverSocket
protected ServerSocketChannel serverSocketChannel
ServerSocketChannel used in blocking mode.
protected boolean initialized
protected volatile boolean running
protected String domain
protected ObjectName oname
protected ObjectName globalRequestProcessorName
protected MBeanServer mserver
protected ObjectName processorWorkerThreadName
protected boolean tcpNoDelay
protected int linger
protected int socketTimeout
protected boolean socketKeepAlive
protected int maxKeepAliveRequests
protected boolean oOBInline
protected int socketReceiveBufferSize
protected int socketSendBufferSize
protected String compression
protected String noCompressionUserAgents
protected String restrictedUserAgents
protected String compressableMimeTypes
protected int compressionMinSize
protected boolean bufferResponse
protected int maxHttpHeaderSize
protected int minReadQueueLength
Read*Task instance.
protected int minProcessorQueueLength
ProcessorTask instance.
protected int maxPostSize
protected Selector selector
Selector used by the connector.
protected Adapter adapter
protected Pipeline readPipeline
protected Pipeline processorPipeline
protected PipelineStatistic pipelineStat
Pipeline statistic.
protected String pipelineClassName
Pipeline used.
protected int maxProcessorWorkerThreads
WorkerThread
protected int maxReadWorkerThreads
ReadWorkerThread
protected int minWorkerThreads
WorkerThread created
protected int maxSelectors
Selectors in the SelectorFactory pool
protected int minSpareThreads
WorkerThread
before creating new thread.
protected int threadsIncrement
Pipeline
thread pool.
protected int threadsTimeout
protected boolean useDirectByteBuffer
ByteBuffer used by the ReadTask use
direct ByteBuffer or not.
protected RequestGroupInfo globalRequestProcessor
protected boolean displayConfiguration
true, display the NIO configuration information.
protected boolean isMonitoringEnabled
protected int currentConnectionNumber
protected volatile boolean isWaiting
protected int requestBufferSize
protected boolean useByteBufferView
ByteBuffer from another ByteBuffer
protected int keepAliveTimeoutInSeconds
protected boolean recycleTasks
Task after running them
protected static int selectorTimeout
Selector timeout value. By default, it is set to 60000
miliseconds (as in the j2se 1.5 ORB).
protected int maxQueueSizeInBytes
protected Class algorithmClass
Algorithm used to predict the end of the NIO stream
protected String algorithmClassName
Algorithm used to parse the NIO stream.
public static final String DEFAULT_ALGORITHM
protected int ssBackLog
protected String defaultResponseType
protected String forcedRequestType
protected static String rootFolder
protected Queue<ProcessorTask> processorTasks
ConcurrentLinkedQueue used as an object pool.
If the list becomes empty, new ProcessorTask will be
automatically added to the list.
protected Queue<ReadTask> readTasks
ConcurrentLinkedQueue used as an object pool.
If the list becomes empty, new ReadTask will be
automatically added to the list.
protected Queue<ProcessorTask> activeProcessorTasks
ProcessorTask.
protected int multiSelectorsCount
SelectorReadThread
protected MultiSelectorThread[] readThreads
Selector used to register OP_READ
protected static Logger logger
protected boolean disableUploadTimeout
protected int uploadTimeout
protected KeepAlivePipeline keepAlivePipeline
SelectionKey will stay forever in the
Selector keys, and this will eventualy produce a
memory leak.
protected FileCacheFactory fileCacheFactory
protected int secondsMaxAge
protected int maxCacheEntries
fileCache
protected long minEntrySize
protected long maxEntrySize
protected long maxLargeFileCacheSize
protected long maxSmallFileCacheSize
protected boolean isFileCacheEnabled
protected boolean isLargeFileCacheEnabled
protected boolean asyncExecution
protected AsyncHandler asyncHandler
AsyncHandler
protected static boolean defaultAlgorithmInstalled
protected boolean enableNioLogging
protected Queue<SelectionKey> bannedKeys
| Constructor Detail |
|---|
public SelectorThread()
Selector object. Each instance of this class
will listen to a specific port.
| Method Detail |
|---|
public static final SelectorThread getSelector(int port)
SelectorThread which listen on port, or null
if there is no SelectorThread.
public static final Enumeration<SelectorThread> getSelectors()
Enumeration of the active
SelectorThreads
public void enableSelectionKeys()
public void addBannedSelectionKey(SelectionKey key)
SelectionKey to the banned list of SelectionKeys.
A SelectionKey is banned when new registration aren't allowed on the
Selector.
public void registerKey(SelectionKey key)
SelectionKey to this Selector
running of this thread.
public void initEndpoint()
throws IOException,
InstantiationException
ServerScoketChannel
and by initializing the server socket.
IOException
InstantiationException
protected Pipeline newPipeline(int maxThreads,
int minThreads,
String name,
int port,
int priority)
Pipeline instance using the
pipelineClassName value.
protected void initFileCacheFactory()
protected void enablePipelineStats()
PipelineStatistic into every
Pipeline, for monitoring purposes.
protected void disablePipelineStats()
PipelineStatistic from every
Pipeline, when monitoring has been turned off.
protected void initAlgorithm()
Algorithm class.
protected void initKeepAlivePipeline()
protected void initPipeline()
Pipelines used by the WorkerThreads.
protected void initReadTask(int size)
ReadTask
protected ReadTask newReadTask()
ReadTask instance
protected void initMultiSelectors()
throws IOException,
InstantiationException
SelectorReadThread used to process
OP_READ operations.
IOException
InstantiationException
protected void configureReadThread(SelectorThread multiSelector)
throws IOException,
InstantiationException
IOException
InstantiationExceptionprotected void initProcessorTask(int size)
ProcessorTask
protected void rampUpProcessorTask()
ProcessorTask
protected ProcessorTask newProcessorTask(boolean initialize)
ProcessorTask objects and configure it to be ready
to proceed request.
protected ProcessorTask configureProcessorTask(DefaultProcessorTask task)
protected void reconfigureAsyncExecution()
public ProcessorTask getProcessorTask()
ProcessorTask from the pool. If the pool is empty,
create a new instance.
public ReadTask getReadTask(SelectionKey key)
throws IOException
ReadTask from the pool. If the pool is empty,
create a new instance.
IOExceptionpublic void run()
run in interface Runnablerun in class Thread
public void startEndpoint()
throws IOException,
InstantiationException
IOException
InstantiationExceptionprotected void startPipelines()
Pipeline used by this Selector
protected void stopPipelines()
Pipeline used by this Selector
protected void startListener()
Selector object.
public void resetSpinCounter()
public int getSpinRate()
protected void doSelect()
Selector.select() operation.
protected void expireIdleKeys()
protected void handleConnection(SelectionKey key)
throws IOException,
InterruptedException
IOException
InterruptedException
protected void handleAccept(SelectionKey key)
throws IOException
IOException
protected ReadTask handleRead(SelectionKey key)
throws IOException
IOExceptionpublic void cancelKey(SelectionKey key)
SelectionKey
public void returnTask(Task task)
Task object to the pool.
public void wakeup()
Selector associated with this thread.
protected void clearTasks()
Tasks
public boolean cancelThreadExecution(long cancelThreadID)
threadID execution. Return true
if it is successful.
id - the thread name to cancelpublic void stopEndpoint()
public void setMaxThreads(int maxThreads)
public int getMaxThreads()
public void setMaxSpareThreads(int maxThreads)
public int getMaxSpareThreads()
public void setMinSpareThreads(int minSpareThreads)
public int getMinSpareThreads()
public int getPort()
public int getPortLowLevel()
public void setPort(int port)
public InetAddress getAddress()
public void setAddress(InetAddress inet)
public boolean isRunning()
public int getCurrentBusyProcessorThreads()
public void setServerTimeout(int timeout)
By default this value is 1000ms.
public boolean getTcpNoDelay()
public void setTcpNoDelay(boolean b)
public int getSoLinger()
public void setSoLinger(int i)
public int getSoTimeout()
public void setSoTimeout(int i)
public int getServerSoTimeout()
public void setServerSoTimeout(int i)
public int getQueueSizeInBytes()
Pipeline
can handle.
public int getMaxKeepAliveRequests()
public void setMaxKeepAliveRequests(int mkar)
public void setKeepAliveTimeoutInSeconds(int timeout)
timeout - Keep-alive timeout in number of secondspublic int getKeepAliveTimeoutInSeconds()
public void setKeepAliveThreadCount(int threadCount)
threadCount - Number of keep-alive threadspublic void setAdapter(Adapter adapter)
adapter - the new adapterpublic Adapter getAdapter()
protected void setSocketOptions(Socket socket)
public ObjectName getObjectName()
public String getDomain()
public ObjectName preRegister(MBeanServer server,
ObjectName name)
throws Exception
preRegister in interface MBeanRegistrationExceptionpublic void postRegister(Boolean registrationDone)
postRegister in interface MBeanRegistration
public void preDeregister()
throws Exception
preDeregister in interface MBeanRegistrationExceptionpublic void postDeregister()
postDeregister in interface MBeanRegistrationprotected void registerComponents()
protected void unregisterComponents()
public void enableMonitoring()
public void disableMonitoring()
public boolean isMonitoringEnabled()
true if monitoring has been enabled,
false otherwise.
public RequestGroupInfo getRequestGroupInfo()
public KeepAliveStats getKeepAliveStats()
protected void initMonitoringLevel()
public int getMaxHttpHeaderSize()
public void setMaxHttpHeaderSize(int maxHttpHeaderSize)
public void setMinThreads(int minWorkerThreads)
public void setBufferSize(int requestBufferSize)
public int getBufferSize()
public Selector getSelector()
public int getCountThreadsStats()
public int getCountThreadsIdleStats()
public int getCurrentThreadCountStats()
public int getCurrentThreadsBusyStats()
public int getMaxSpareThreadsStats()
public int getMinSpareThreadsStats()
public int getMaxThreadsStats()
public void removeCacheEntry(String contextPath)
FileCache.
public void setSecondsMaxAge(int sMaxAges)
FileCacheEntry
from the fileCache
public void setMaxCacheEntries(int mEntries)
public int getMaxCacheEntries()
public void setMinEntrySize(long mSize)
FileCacheEntry can have.
public long getMinEntrySize()
FileCacheEntry can have.
public void setMaxEntrySize(long mEntrySize)
FileCacheEntry can have.
public long getMaxEntrySize()
FileCacheEntry can have.
public void setMaxLargeCacheSize(long mCacheSize)
public long getMaxLargeCacheSize()
public void setMaxSmallCacheSize(long mCacheSize)
public long getMaxSmallCacheSize()
public boolean isFileCacheEnabled()
public void setFileCacheIsEnabled(boolean isFileCacheEnabled)
public void setLargeFileCacheEnabled(boolean isLargeEnabled)
public boolean getLargeFileCacheEnabled()
public void setEnableAsyncExecution(boolean asyncExecution)
AsyncHandler used when asynchronous
public boolean getEnableAsyncExecution()
public void setAsyncHandler(AsyncHandler asyncHandler)
AsyncHandler used when asynchronous execution is
enabled.
public AsyncHandler getAsyncHandler()
AsyncHandler used when asynchronous execution is
enabled.
public static void setLogger(Logger l)
public static Logger logger()
public static void setWebAppRootPath(String rf)
public static String getWebAppRootPath()
public int getMaxReadWorkerThreads()
public Pipeline getReadPipeline()
Pipeline used to handle OP_READ.
protected void configureCompression(DefaultProcessorTask processorTask)
public boolean getBufferResponse()
true if the reponse is buffered.
public void setBufferResponse(boolean bufferResponse)
trueif the reponse willk be buffered.
public void enableCometSupport(boolean enableComet)
public void enableRcmSupport(boolean rcmSupport)
public int getServerTimeout()
public InetAddress getInet()
public void setInet(InetAddress inet)
public ServerSocket getServerSocket()
public void setServerSocket(ServerSocket serverSocket)
public ServerSocketChannel getServerSocketChannel()
public void setServerSocketChannel(ServerSocketChannel serverSocketChannel)
public boolean isInitialized()
public void setInitialized(boolean initialized)
public void setRunning(boolean running)
public void setDomain(String domain)
public ObjectName getOname()
public void setOname(ObjectName oname)
public ObjectName getGlobalRequestProcessorName()
public void setGlobalRequestProcessorName(ObjectName globalRequestProcessorName)
public ObjectName getKeepAliveMbeanName()
public void setKeepAliveMbeanName(ObjectName keepAliveMbeanName)
public ObjectName getPwcConnectionQueueMbeanName()
public void setPwcConnectionQueueMbeanName(ObjectName pwcConnectionQueueMbeanName)
public ObjectName getPwcFileCacheMbeanName()
public void setPwcFileCacheMbeanName(ObjectName pwcFileCacheMbeanName)
public MBeanServer getMserver()
public void setMserver(MBeanServer mserver)
public ObjectName getProcessorWorkerThreadName()
public void setProcessorWorkerThreadName(ObjectName processorWorkerThreadName)
public boolean isTcpNoDelay()
public int getLinger()
public void setLinger(int linger)
public boolean isSocketKeepAlive()
public void setSocketKeepAlive(boolean socketKeepAlive)
public int getSocketTimeout()
public void setSocketTimeout(int socketTimeout)
public int getSocketReceiveBufferSize()
public void setSocketReceiveBufferSize(int socketReceiveBufferSize)
public int getSocketSendBufferSize()
public void setSocketSendBufferSize(int socketSendBufferSize)
public String getCompression()
public void setCompression(String compression)
public String getNoCompressionUserAgents()
public void setNoCompressionUserAgents(String noCompressionUserAgents)
public String getRestrictedUserAgents()
public void setRestrictedUserAgents(String restrictedUserAgents)
public String getCompressableMimeTypes()
public void setCompressableMimeTypes(String compressableMimeTypes)
public int getCompressionMinSize()
public void setCompressionMinSize(int compressionMinSize)
public boolean isBufferResponse()
public int getMinReadQueueLength()
public void setMinReadQueueLength(int minReadQueueLength)
public int getMinProcessorQueueLength()
public void setMinProcessorQueueLength(int minProcessorQueueLength)
public void setSelector(Selector selector)
public int getSelectorReadThreadsCount()
public void setSelectorReadThreadsCount(int multiSelectorsCount)
public void setReadPipeline(Pipeline readPipeline)
public Pipeline getProcessorPipeline()
public void setProcessorPipeline(Pipeline processorPipeline)
public PipelineStatistic getPipelineStat()
public void setPipelineStat(PipelineStatistic pipelineStat)
public String getPipelineClassName()
public void setPipelineClassName(String pipelineClassName)
public int getMaxSelectors()
public void setMaxSelectors(int maxSelectors)
public int getMaxProcessorWorkerThreads()
public void setMaxProcessorWorkerThreads(int maxProcessorWorkerThreads)
public void setMaxReadWorkerThreads(int maxReadWorkerThreads)
public int getMinWorkerThreads()
public void setMinWorkerThreads(int minWorkerThreads)
public int getThreadsIncrement()
public void setThreadsIncrement(int threadsIncrement)
public int getThreadsTimeout()
public void setThreadsTimeout(int threadsTimeout)
public boolean isUseDirectByteBuffer()
public void setUseDirectByteBuffer(boolean useDirectByteBuffer)
public RequestGroupInfo getGlobalRequestProcessor()
public void setGlobalRequestProcessor(RequestGroupInfo globalRequestProcessor)
public void setKeepAliveStats(KeepAliveStats keepAliveStats)
public boolean isDisplayConfiguration()
public void setDisplayConfiguration(boolean displayConfiguration)
public boolean isIsMonitoringEnabled()
public void setIsMonitoringEnabled(boolean isMonitoringEnabled)
public int getCurrentConnectionNumber()
public void setCurrentConnectionNumber(int currentConnectionNumber)
public void setIsWaiting(boolean isWaiting)
public boolean isUseByteBufferView()
public void setUseByteBufferView(boolean useByteBufferView)
public int getKaTimeout()
public void setKaTimeout(int kaTimeout)
public boolean isRecycleTasks()
public void setRecycleTasks(boolean recycleTasks)
public static int getSelectorTimeout()
public static void setSelectorTimeout(int aSelectorTimeout)
public int getMaxQueueSizeInBytes()
public void setMaxQueueSizeInBytes(int maxQueueSizeInBytes)
public Class getAlgorithmClass()
public void setAlgorithmClass(Class algorithmClass)
public String getAlgorithmClassName()
public void setAlgorithmClassName(String algorithmClassName)
public int getSsBackLog()
public void setSsBackLog(int ssBackLog)
public long getNextKeysExpiration()
public void setNextKeysExpiration(long nextKeysExpiration)
public String getDefaultResponseType()
public void setDefaultResponseType(String defaultResponseType)
public String getForcedRequestType()
public void setForcedRequestType(String forcedRequestType)
public static String getRootFolder()
public static void setRootFolder(String aRootFolder)
public Queue<SelectionKey> getKeysToEnable()
public void setKeysToEnable(Queue<SelectionKey> keysToEnable)
public Queue<ProcessorTask> getProcessorTasks()
public void setProcessorTasks(Queue<ProcessorTask> processorTasks)
public Queue<ReadTask> getReadTasks()
public void setReadTasks(Queue<ReadTask> readTasks)
public Queue<ProcessorTask> getActiveProcessorTasks()
public void setActiveProcessorTasks(Queue<ProcessorTask> activeProcessorTasks)
public int getCurReadThread()
public void setCurReadThread(int curReadThread)
public static Logger getLogger()
public Management getManagement()
public void setManagement(Management jmxManagement)
public ClassLoader getClassLoader()
public void setClassLoader(ClassLoader classLoader)
ClassLoader used to load configurable
classes (Pipeline, StreamAlgorithm).
public boolean isEnableNioLogging()
public void setEnableNioLogging(boolean enableNioLogging)
public int getMaxPostSize()
public void setMaxPostSize(int maxPostSize)
public void setReuseAddress(boolean reuseAddress)
public boolean getReuseAddress()
public KeepAlivePipeline getKeepAlivePipeline()
public void setKeepAlivePipeline(KeepAlivePipeline keepAlivePipeline)
public void setDisableUploadTimeout(boolean isDisabled)
public boolean getDisableUploadTimeout()
public void setUploadTimeout(int uploadTimeout)
public int getTimeout()
public int getTransactionTimeout()
WorkerThread executing
an instance of this class can execute.
public void setTransactionTimeout(int transactionTimeout)
WrokerThread processing
an instance of this class.
transactionTimeout - the maximum time, in milliseconds.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||