Fields Summary |
---|
public static final String | SERVER_NAME |
private Object[] | lock |
protected int | serverTimeout |
protected InetAddress | inet |
protected int | port |
protected ServerSocket | serverSocket |
protected ServerSocketChannel | serverSocketChannelThe ServerSocketChannel used in blocking mode. |
protected boolean | initialized |
protected volatile boolean | running |
protected String | domain |
protected ObjectName | oname |
protected ObjectName | globalRequestProcessorName |
private ObjectName | keepAliveMbeanName |
private ObjectName | pwcConnectionQueueMbeanName |
private ObjectName | pwcFileCacheMbeanName |
protected MBeanServer | mserver |
protected ObjectName | processorWorkerThreadName |
protected boolean | tcpNoDelay |
protected int | linger |
protected int | socketTimeout |
protected int | maxKeepAliveRequests |
protected boolean | oOBInline |
protected String | compressionCompression value. |
protected String | noCompressionUserAgents |
protected String | restrictedUserAgents |
protected String | compressableMimeTypes |
protected int | compressionMinSize |
private boolean | reuseAddressIs the socket reuse socket enabled. |
protected boolean | bufferResponseBuffer the response until the buffer is full. |
protected int | maxHttpHeaderSizeDefault HTTP header buffer size. |
protected int | minReadQueueLengthNumber of polled Read*Task instance. |
protected int | minProcessorQueueLengthNumber of polled ProcessorTask instance. |
protected int | maxPostSize |
protected Selector | selectorThe Selector used by the connector. |
protected org.apache.coyote.Adapter | adapterAssociated adapter. |
protected Pipeline | readPipelineThe queue shared by this thread and code>ReadTask |
protected Pipeline | processorPipelineThe queue shared by this thread and the code>ProcessorTask. |
protected PipelineStatistic | pipelineStatPlaceholder for Pipeline statistic. |
protected String | pipelineClassNameThe default Pipeline used. |
protected int | maxProcessorWorkerThreadsMaximum number of WorkerThread |
protected int | maxReadWorkerThreadsMaximum number of ReadWorkerThread |
protected int | minWorkerThreadsMinimum numbers of WorkerThread created |
protected int | minSpareThreadsMinimum numbers of WorkerThread
before creating new thread.
Not used in 9.x
|
protected int | threadsIncrementThe number used when increamenting the Pipeline
thread pool. |
protected int | threadsTimeoutThe timeout used by the thread when processing a request. |
protected boolean | useDirectByteBufferIs the ByteBuffer used by the ReadTask use
direct ByteBuffer or not. |
protected org.apache.coyote.RequestGroupInfo | globalRequestProcessorMonitoring object used to store information. |
private KeepAliveStats | keepAliveStatsKeep-alive stats |
protected boolean | displayConfigurationIf true , display the NIO configuration information. |
protected boolean | isMonitoringEnabledIs monitoring already started. |
protected int | currentConnectionNumberThe current number of simulatenous connection. |
protected volatile boolean | isWaitingIs this Selector currently in Wating mode? |
protected int | requestBufferSizeThe input request buffer size. |
protected boolean | useByteBufferViewCreate view ByteBuffer from another ByteBuffer |
protected int | keepAliveTimeoutInSeconds |
private int | kaTimeoutNumber of seconds before idle keep-alive connections expire |
protected boolean | recycleTasksRecycle the Task after running them |
protected static int | selectorTimeoutThe Selector timeout value. By default, it is set to 60000
miliseconds (as in the j2se 1.5 ORB). |
protected int | maxQueueSizeInBytesMaximum pending connection before refusing requests. |
protected Class | algorithmClassThe Algorithm used to predict the end of the NIO stream |
protected String | algorithmClassNameThe Algorithm used to parse the NIO stream. |
public static final String | DEFAULT_ALGORITHMThe default NIO stream algorithm. |
protected int | ssBackLogServer socket backlog. |
private long | nextKeysExpirationNext time the exprireKeys() will delete keys. |
protected String | defaultResponseTypeThe default response-type |
protected String | forcedRequestTypeThe forced request-type |
protected static String | rootFolderThe root folder where application are deployed |
private ConcurrentLinkedQueue | keysToEnableList of SelectionKey event to register next time the
Selector wakeups. This is needed since there a bug
in j2se 1.4.x that prevent registering selector event if the call
is done on another thread. |
protected ConcurrentLinkedQueue | processorTasksConcurrentLinkedQueue used as an object pool.
If the list becomes empty, new ProcessorTask will be
automatically added to the list. |
protected ConcurrentLinkedQueue | readTasksConcurrentLinkedQueue used as an object pool.
If the list becomes empty, new ReadTask will be
automatically added to the list. |
protected ConcurrentLinkedQueue | activeProcessorTasksList of active ProcessorTask . |
protected int | multiSelectorsCountThe number of SelectorReadThread |
protected MultiSelectorThread[] | readThreadsThe Selector used to register OP_READ |
int | curReadThreadThe current readThreads used to process OP_READ. |
protected static Logger | loggerThe logger used by the grizzly classes. |
protected boolean | disableUploadTimeoutFlag to disable setting a different time-out on uploads. |
protected int | uploadTimeoutMaximum timeout on uploads. 5 minutes as in Apache HTTPD server. |
protected KeepAlivePipeline | keepAlivePipelineKeep-Alive subsystem. If a client opens a socket but never close it,
the SelectionKey will stay forever in the
Selector keys, and this will eventualy produce a
memory leak. |
protected FileCacheFactory | fileCacheFactoryThe FileCacheFactory associated with this Selector |
protected int | secondsMaxAgeTimeout before remove the static resource from the cache. |
protected int | maxCacheEntriesThe maximum entries in the fileCache |
protected long | minEntrySizeThe maximum size of a cached resources. |
protected long | maxEntrySizeThe maximum size of a cached resources. |
protected long | maxLargeFileCacheSizeThe maximum cached bytes |
protected long | maxSmallFileCacheSizeThe maximum cached bytes |
protected boolean | isFileCacheEnabledIs the FileCache enabled. |
protected boolean | isLargeFileCacheEnabledIs the large FileCache enabled. |
protected boolean | asyncExecutionIs asynchronous mode enabled? |
protected AsyncHandler | asyncHandlerWhen the asynchronous mode is enabled, the execution of this object
will be delegated to the AsyncHandler |
protected static boolean | defaultAlgorithmInstalledIs the DEFAULT_ALGORITHM used. |
private Management | jmxManagementThe JMX Management class. |
private ClassLoader | classLoaderThe Classloader used to load instance of StreamAlgorithm. |
protected boolean | enableNioLoggingGrizzly own debug flag. |
private static final ConcurrentHashMap | selectorThreadsStatic list of current instance of this class. |
protected ConcurrentLinkedQueue | bannedKeysBanned SelectionKey registration. |
Methods Summary |
---|
public void | addBannedSelectionKey(java.nio.channels.SelectionKey key)Add a SelectionKey to the banned list of SelectionKeys.
A SelectionKey is banned when new registration aren't allowed on the
Selector.
bannedKeys.offer(key);
|
public void | cancelKey(java.nio.channels.SelectionKey key)Cancel the current SelectionKey
if (key == null){
return;
}
keepAlivePipeline.untrap(key);
if (!processorPipeline.expireKey(key)){
return;
}
if (enableNioLogging){
logger.log(Level.INFO,"Closing SocketChannel " +
key.channel());
}
Socket socket = ((SocketChannel)key.channel()).socket();
try{
if (!socket.isInputShutdown()){
socket.shutdownInput();
}
} catch (IOException ex){
;
}
try{
if (!socket.isOutputShutdown()){
socket.shutdownOutput();
}
} catch (IOException ex){
;
}
try{
if (!socket.isClosed()){
socket.close();
}
} catch (IOException ex){
;
} finally {
try{
// This is not needed but just to make sure the JDK isn't
// leaking any fd.
if (key.channel().isOpen()){
key.channel().close();
}
} catch (IOException ex){
logger.log(Level.FINEST,"selectorThread.unableToCloseKey", key);
}
if (isMonitoringEnabled()) {
getRequestGroupInfo().decreaseCountOpenConnections();
}
}
// Set the attachement to null so the Selector.java handleConnection
// stop processing this key.
key.attach(null);
key.cancel();
key = null;
|
public boolean | cancelThreadExecution(long cancelThreadID)Cancel the threadID execution. Return true
if it is successful.
if ( multiSelectorsCount > 1 ){
boolean cancelled = false;
for (MultiSelectorThread readSelector : readThreads) {
cancelled = ((SelectorReadThread)readSelector).
cancelThreadExecution(cancelThreadID);
if (cancelled) return true;
}
return false;
}
if (activeProcessorTasks.size() == 0) return false;
Iterator<ProcessorTask> iterator = activeProcessorTasks.iterator();
ProcessorTask processorTask;
long threadID;
while( iterator.hasNext() ){
processorTask = iterator.next();
threadID = processorTask.getWorkerThreadID();
if (threadID == cancelThreadID){
processorTask.cancelTask("Request cancelled.","500");
logger.log(Level.WARNING,
"Thread Request Cancelled: " + threadID);
return processorTask.getPipeline().interruptThread(threadID);
}
}
return false;
|
protected void | clearTasks()Clear all cached Tasks
processorTasks.clear();
readTasks.clear();
|
private void | closeActiveConnections()
Set<SelectionKey> readyKeys = selector.keys();
if (readyKeys.isEmpty()){
return;
}
Iterator<SelectionKey> iterator = readyKeys.iterator();
SelectionKey key;
while (iterator.hasNext()) {
key = iterator.next();
if (key.channel() instanceof SocketChannel){
cancelKey(key);
} else {
key.cancel();
}
}
|
protected void | configureCompression(DefaultProcessorTask processorTask)
processorTask.setCompression(compression);
processorTask.addNoCompressionUserAgent(noCompressionUserAgents);
processorTask.addCompressableMimeType(compressableMimeTypes);
processorTask.setCompressionMinSize(compressionMinSize);
processorTask.addRestrictedUserAgent(restrictedUserAgents);
|
protected ProcessorTask | configureProcessorTask(DefaultProcessorTask task)
task.setAdapter(adapter);
task.setMaxHttpHeaderSize(maxHttpHeaderSize);
task.setBufferSize(requestBufferSize);
task.setSelectorThread(this);
task.setRecycle(recycleTasks);
task.setDefaultResponseType(defaultResponseType);
task.setForcedRequestType(forcedRequestType);
task.setMaxPostSize(maxPostSize);
task.setTimeout(uploadTimeout);
task.setDisableUploadTimeout(disableUploadTimeout);
if ( keepAlivePipeline.dropConnection() ) {
task.setDropConnection(true);
}
// Asynch extentions
if ( asyncExecution ) {
task.setEnableAsyncExecution(asyncExecution);
task.setAsyncHandler(asyncHandler);
}
task.setPipeline(processorPipeline);
configureCompression(task);
return (ProcessorTask)task;
|
protected void | configureReadThread(com.sun.enterprise.web.connector.grizzly.SelectorThread multiSelector)
multiSelector.setMaxThreads(maxProcessorWorkerThreads);
multiSelector.setBufferSize(requestBufferSize);
multiSelector.setMaxKeepAliveRequests(maxKeepAliveRequests);
multiSelector
.setKeepAliveTimeoutInSeconds(keepAliveTimeoutInSeconds);
multiSelector.maxQueueSizeInBytes = maxQueueSizeInBytes;
multiSelector.fileCacheFactory = fileCacheFactory;
multiSelector.maxReadWorkerThreads = maxReadWorkerThreads;
multiSelector.defaultResponseType = defaultResponseType;
multiSelector.forcedRequestType = forcedRequestType;
multiSelector.minReadQueueLength = minReadQueueLength;
multiSelector.maxHttpHeaderSize = maxHttpHeaderSize;
multiSelector.isMonitoringEnabled = isMonitoringEnabled();
multiSelector.pipelineStat = pipelineStat;
multiSelector.globalRequestProcessor = globalRequestProcessor;
if ( asyncExecution ) {
multiSelector.asyncExecution = asyncExecution;
multiSelector.asyncHandler = asyncHandler;
}
multiSelector.threadsIncrement = threadsIncrement;
multiSelector.setPort(port);
multiSelector.setAdapter(adapter);
multiSelector.processorPipeline = processorPipeline;
multiSelector.readPipeline = readPipeline;
multiSelector.readTasks = readTasks;
multiSelector.processorTasks = processorTasks;
multiSelector.keepAlivePipeline = keepAlivePipeline;
multiSelector.domain = domain;
multiSelector.bufferResponse = bufferResponse;
multiSelector.initEndpoint();
multiSelector.start();
|
public void | disableMonitoring()Disable gathering of monitoring datas.
disablePipelineStats();
if ( readThreads != null ) {
for (int i = 0; i < readThreads.length; i++) {
((SelectorReadThread)readThreads[i]).isMonitoringEnabled = false;
}
}
fileCacheFactory.setIsMonitoringEnabled(isMonitoringEnabled);
|
protected void | disablePipelineStats()Removes PipelineStatistic from every
Pipeline , when monitoring has been turned off.
pipelineStat.stop();
processorPipeline.setPipelineStatistic(null);
pipelineStat.setProcessorPipeline(null);
if (keepAlivePipeline != null){
keepAlivePipeline.setKeepAliveStats(null);
}
|
private void | displayConfiguration()Display the Grizzly configuration parameters.
if (displayConfiguration){
logger.log(Level.INFO,
"\n Grizzly configuration for port "
+ port
+ "\n\t maxThreads: "
+ maxProcessorWorkerThreads
+ "\n\t minThreads: "
+ minWorkerThreads
+ "\n\t ByteBuffer size: "
+ requestBufferSize
+ "\n\t useDirectByteBuffer: "
+ useDirectByteBuffer
+ "\n\t useByteBufferView: "
+ useByteBufferView
+ "\n\t maxHttpHeaderSize: "
+ maxHttpHeaderSize
+ "\n\t maxKeepAliveRequests: "
+ maxKeepAliveRequests
+ "\n\t keepAliveTimeoutInSeconds: "
+ keepAliveTimeoutInSeconds
+ "\n\t Static File Cache enabled: "
+ isFileCacheEnabled
+ "\n\t Stream Algorithm : "
+ algorithmClassName
+ "\n\t Pipeline : "
+ pipelineClassName
+ "\n\t Round Robin Selector Algorithm enabled: "
+ ( multiSelectorsCount > 1 )
+ "\n\t Round Robin Selector pool size: "
+ multiSelectorsCount
+ "\n\t recycleTasks: "
+ recycleTasks
+ "\n\t Asynchronous Request Processing enabled: "
+ asyncExecution);
}
|
protected void | doSelect()Execute a Selector.select() operation.
SelectionKey key = null;
Set readyKeys;
Iterator<SelectionKey> iterator;
int selectorState;
try{
selectorState = 0;
enableSelectionKeys();
try{
selectorState = selector.select(selectorTimeout);
} catch (CancelledKeyException ex){
;
}
if (!running) return;
readyKeys = selector.selectedKeys();
iterator = readyKeys.iterator();
while (iterator.hasNext()) {
key = iterator.next();
iterator.remove();
if (key.isValid()) {
handleConnection(key);
} else {
cancelKey(key);
}
}
expireIdleKeys();
if (selectorState <= 0){
selector.selectedKeys().clear();
return;
}
} catch (Throwable t){
if (key != null && key.isValid()){
logger.log(Level.SEVERE,"selectorThread.errorOnRequest",t);
} else {
logger.log(Level.FINE,"selectorThread.errorOnRequest",t);
}
if ( key != null ){
key.attach(null);
key.cancel();
}
}
|
public void | enableCometSupport(boolean enableComet)Enable Comet/Poll request support.
if ( enableComet ){
asyncExecution = true;
setBufferResponse(false);
isFileCacheEnabled = false;
isLargeFileCacheEnabled = false;
asyncHandler = new DefaultAsyncHandler();
asyncHandler.addAsyncFilter(new CometAsyncFilter());
SelectorThread.logger()
.log(Level.INFO,"Enabling Grizzly ARP Comet support.");
} else {
asyncExecution = false;
}
|
public void | enableMonitoring()Enable gathering of monitoring datas.
isMonitoringEnabled = true;
enablePipelineStats();
if ( readThreads != null ) {
for (int i = 0; i < readThreads.length; i++) {
((SelectorReadThread)readThreads[i]).isMonitoringEnabled = true;
}
}
fileCacheFactory.setIsMonitoringEnabled(isMonitoringEnabled);
|
protected void | enablePipelineStats()Injects PipelineStatistic into every
Pipeline , for monitoring purposes.
pipelineStat.start();
processorPipeline.setPipelineStatistic(pipelineStat);
pipelineStat.setProcessorPipeline(processorPipeline);
if (keepAlivePipeline != null){
keepAlivePipeline.setKeepAliveStats(keepAliveStats);
}
|
public void | enableRcmSupport(boolean rcmSupport)Enable Application Resource Allocation Grizzly Extension.
if (rcmSupport){
// Avoid dependency on that extension. If the package is renamed
// an exception will be logged later when the SelectorThread start.
pipelineClassName = "com.sun.enterprise.web.ara.IsolationPipeline";
}
|
public void | enableSelectionKeys()Enable all registered interestOps. Due a a NIO bug, all interestOps
invokation needs to occurs on the same thread as the selector thread.
SelectionKey selectionKey;
int size = keysToEnable.size();
long currentTime = 0L;
if (size > 0){
currentTime = (Long)System.currentTimeMillis();
}
for (int i=0; i < size; i++) {
selectionKey = keysToEnable.poll();
// If the SelectionKey is used for continuation, do not allow
// the key to be registered.
if (asyncExecution && !bannedKeys.isEmpty()
&& bannedKeys.remove(selectionKey)){
continue;
}
if (!selectionKey.isValid() || !keepAlivePipeline.trap(selectionKey)){
cancelKey(selectionKey);
continue;
}
selectionKey.interestOps(
selectionKey.interestOps() | SelectionKey.OP_READ);
if (selectionKey.attachment() == null)
selectionKey.attach(currentTime);
}
|
protected void | expireIdleKeys()Cancel keep-alive connections.
if ( keepAliveTimeoutInSeconds <= 0 || !selector.isOpen()) return;
long current = System.currentTimeMillis();
if (current < nextKeysExpiration) {
return;
}
nextKeysExpiration = current + kaTimeout;
Set<SelectionKey> readyKeys = selector.keys();
if (readyKeys.isEmpty()){
return;
}
Iterator<SelectionKey> iterator = readyKeys.iterator();
SelectionKey key;
while (running && iterator.hasNext()) {
key = iterator.next();
// Keep-alive expired
Object attachment = key.attachment();
if (attachment != null) {
if ( !defaultAlgorithmInstalled
&& !(attachment instanceof Long)) {
continue;
}
try{
long expire = (Long)attachment;
if (current - expire >= kaTimeout) {
if (enableNioLogging){
logger.log(Level.INFO,
"Keep-Alive expired for SocketChannel " +
key.channel());
}
cancelKey(key);
} else if (expire + kaTimeout < nextKeysExpiration){
nextKeysExpiration = expire + kaTimeout;
}
} catch (ClassCastException ex){
if (logger.isLoggable(Level.FINEST)){
logger.log(Level.FINEST,
"Invalid SelectionKey attachment",ex);
}
}
}
}
|
public java.util.concurrent.ConcurrentLinkedQueue | getActiveProcessorTasks()
return activeProcessorTasks;
|
public org.apache.coyote.Adapter | getAdapter()Get the associated adapter.
return adapter;
|
public java.net.InetAddress | getAddress()
return inet;
|
public java.lang.Class | getAlgorithmClass()
return algorithmClass;
|
public java.lang.String | getAlgorithmClassName()
return algorithmClassName;
|
public AsyncHandler | getAsyncHandler()Return the AsyncHandler used when asynchronous execution is
enabled.
return asyncHandler;
|
public boolean | getBufferResponse()Return true if the reponse is buffered.
return bufferResponse;
|
public int | getBufferSize()Return the request input buffer size
return requestBufferSize;
|
public java.lang.ClassLoader | getClassLoader()
return classLoader;
|
public java.lang.String | getCompressableMimeTypes()
return compressableMimeTypes;
|
public java.lang.String | getCompression()
return compression;
|
public int | getCompressionMinSize()
return compressionMinSize;
|
public int | getCountThreadsIdleStats()
int ret = processorPipeline.getWaitingThread();
if (readPipeline != null
&& readPipeline != processorPipeline) {
ret += readPipeline.getWaitingThread();
}
return ret;
|
public int | getCountThreadsStats()PWCThreadPool Stats
int ret = processorPipeline.getCurrentThreadCount();
if (readPipeline != null
&& readPipeline != processorPipeline) {
ret += readPipeline.getCurrentThreadCount();
}
return ret;
|
public int | getCurReadThread()
return curReadThread;
|
public int | getCurrentBusyProcessorThreads()Provides the count of request threads that are currently
being processed by the container
int busy = 0;
// multi selector support
if (multiSelectorsCount > 1) {
for (MultiSelectorThread readSelector : readThreads) {
busy += ((SelectorReadThread)readSelector)
.getCurrentBusyProcessorThreads();
}
} else {
busy = processorPipeline.getCurrentThreadsBusy();
}
return busy;
|
public int | getCurrentConnectionNumber()
return currentConnectionNumber;
|
public int | getCurrentThreadCountStats()HTTPListener Stats
int ret = processorPipeline.getCurrentThreadCount();
if (readPipeline != null
&& readPipeline != processorPipeline) {
ret += readPipeline.getCurrentThreadCount();
}
return ret;
|
public int | getCurrentThreadsBusyStats()
int ret = processorPipeline.getCurrentThreadsBusy();
if (readPipeline != null
&& readPipeline != processorPipeline) {
ret += readPipeline.getCurrentThreadsBusy();
}
return ret;
|
public java.lang.String | getDefaultResponseType()
return defaultResponseType;
|
public boolean | getDisableUploadTimeout()Get the flag that controls upload time-outs.
return disableUploadTimeout;
|
public java.lang.String | getDomain()
return domain;
|
public boolean | getEnableAsyncExecution()Return true when asynchronous execution is
enabled.
return asyncExecution;
|
public java.lang.String | getForcedRequestType()
return forcedRequestType;
|
public org.apache.coyote.RequestGroupInfo | getGlobalRequestProcessor()
return globalRequestProcessor;
|
public javax.management.ObjectName | getGlobalRequestProcessorName()
return globalRequestProcessorName;
|
public java.net.InetAddress | getInet()
return inet;
|
public int | getKaTimeout()
return kaTimeout;
|
public javax.management.ObjectName | getKeepAliveMbeanName()
return keepAliveMbeanName;
|
public KeepAlivePipeline | getKeepAlivePipeline()
return keepAlivePipeline;
|
public KeepAliveStats | getKeepAliveStats()
return keepAliveStats;
|
public int | getKeepAliveTimeoutInSeconds()Gets the number of seconds before a keep-alive connection that has
been idle times out and is closed.
return keepAliveTimeoutInSeconds;
|
public java.util.concurrent.ConcurrentLinkedQueue | getKeysToEnable()
return keysToEnable;
|
public boolean | getLargeFileCacheEnabled()Is the large file cache support enabled.
return isLargeFileCacheEnabled;
|
public int | getLinger()
return linger;
|
public static java.util.logging.Logger | getLogger()
return logger;
|
public Management | getManagement()
return jmxManagement;
|
public int | getMaxCacheEntries()Return the maximum entries this cache can contains.
return maxCacheEntries;
|
public long | getMaxEntrySize()Get the maximum size a FileCacheEntry can have.
return maxEntrySize;
|
public int | getMaxHttpHeaderSize()
return maxHttpHeaderSize;
|
public int | getMaxKeepAliveRequests()
return maxKeepAliveRequests;
|
public long | getMaxLargeCacheSize()Get the maximum cache size
return maxLargeFileCacheSize;
|
public int | getMaxPostSize()
return maxPostSize;
|
public int | getMaxProcessorWorkerThreads()
return maxProcessorWorkerThreads;
|
public int | getMaxQueueSizeInBytes()
return maxQueueSizeInBytes;
|
public int | getMaxReadWorkerThreads()
return maxReadWorkerThreads;
|
public long | getMaxSmallCacheSize()Get the maximum cache size
return maxSmallFileCacheSize;
|
public int | getMaxSpareThreads()
return maxProcessorWorkerThreads;
|
public int | getMaxSpareThreadsStats()
int ret = processorPipeline.getMaxSpareThreads();
if (readPipeline != null
&& readPipeline != processorPipeline) {
ret += readPipeline.getMaxSpareThreads();
}
return ret;
|
public int | getMaxThreads()
return maxProcessorWorkerThreads;
|
public int | getMaxThreadsStats()
int ret = processorPipeline.getMaxThreads();
if (readPipeline != null
&& readPipeline != processorPipeline) {
ret += readPipeline.getMaxThreads();
}
return ret;
|
public long | getMinEntrySize()Get the maximum size a FileCacheEntry can have.
return minEntrySize;
|
public int | getMinProcessorQueueLength()
return minProcessorQueueLength;
|
public int | getMinReadQueueLength()
return minReadQueueLength;
|
public int | getMinSpareThreads()
return minSpareThreads;
|
public int | getMinSpareThreadsStats()
int ret = processorPipeline.getMinSpareThreads();
if (readPipeline != null
&& readPipeline != processorPipeline) {
ret += readPipeline.getMinSpareThreads();
}
return ret;
|
public int | getMinWorkerThreads()
return minWorkerThreads;
|
public javax.management.MBeanServer | getMserver()
return mserver;
|
public long | getNextKeysExpiration()
return nextKeysExpiration;
|
public java.lang.String | getNoCompressionUserAgents()
return noCompressionUserAgents;
|
public javax.management.ObjectName | getObjectName()
return oname;
|
public javax.management.ObjectName | getOname()
return oname;
|
public java.lang.String | getPipelineClassName()
return pipelineClassName;
|
public PipelineStatistic | getPipelineStat()
return pipelineStat;
|
public int | getPort()
return port;
|
public Pipeline | getProcessorPipeline()
return processorPipeline;
|
public ProcessorTask | getProcessorTask()Return a ProcessorTask from the pool. If the pool is empty,
create a new instance.
ProcessorTask processorTask = null;
if (recycleTasks) {
processorTask = processorTasks.poll();
}
if (processorTask == null){
processorTask = newProcessorTask(false);
}
if ( isMonitoringEnabled() ){
activeProcessorTasks.offer(processorTask);
}
return processorTask;
|
public java.util.concurrent.ConcurrentLinkedQueue | getProcessorTasks()
return processorTasks;
|
public javax.management.ObjectName | getProcessorWorkerThreadName()
return processorWorkerThreadName;
|
public javax.management.ObjectName | getPwcConnectionQueueMbeanName()
return pwcConnectionQueueMbeanName;
|
public javax.management.ObjectName | getPwcFileCacheMbeanName()
return pwcFileCacheMbeanName;
|
public int | getQueueSizeInBytes()Get the maximum pending connection this Pipeline
can handle.
return maxQueueSizeInBytes;
|
public Pipeline | getReadPipeline()Return the Pipeline used to handle OP_READ.
return readPipeline;
|
public ReadTask | getReadTask(java.nio.channels.SelectionKey key)Return a ReadTask from the pool. If the pool is empty,
create a new instance.
ReadTask task = null;
if ( recycleTasks ) {
task = readTasks.poll();
}
if (task == null){
task = newReadTask();
}
task.setSelectionKey(key);
return task;
|
public java.util.concurrent.ConcurrentLinkedQueue | getReadTasks()
return readTasks;
|
public org.apache.coyote.RequestGroupInfo | getRequestGroupInfo()
return globalRequestProcessor;
|
public java.lang.String | getRestrictedUserAgents()
return restrictedUserAgents;
|
public boolean | getReuseAddress()
return reuseAddress;
|
public static java.lang.String | getRootFolder()
return rootFolder;
|
public static final com.sun.enterprise.web.connector.grizzly.SelectorThread | getSelector(int port)Return the SelectorThread which listen on port, or null
if there is no SelectorThread .
return selectorThreads.get(port);
|
public java.nio.channels.Selector | getSelector()
return selector;
|
private synchronized MultiSelectorThread | getSelectorReadThread()Return an instance of SelectorReadThread to use
for registering OP_READ
if (curReadThread == readThreads.length)
curReadThread = 0;
return readThreads[curReadThread++];
|
public int | getSelectorReadThreadsCount()
return multiSelectorsCount;
|
public static int | getSelectorTimeout()
return selectorTimeout;
|
public static final java.util.Enumeration | getSelectors()Return an Enumeration of the active
SelectorThread s
return selectorThreads.elements();
|
public int | getServerSoTimeout()
return serverTimeout;
|
public java.net.ServerSocket | getServerSocket()
return serverSocket;
|
public java.nio.channels.ServerSocketChannel | getServerSocketChannel()
return serverSocketChannel;
|
public int | getServerTimeout()
return serverTimeout;
|
public int | getSoLinger()
return linger;
|
public int | getSoTimeout()
return socketTimeout;
|
public int | getSocketTimeout()
return socketTimeout;
|
public int | getSsBackLog()
return ssBackLog;
|
public boolean | getTcpNoDelay()
return tcpNoDelay;
|
public int | getThreadsIncrement()
return threadsIncrement;
|
public int | getThreadsTimeout()
return threadsTimeout;
|
public int | getTimeout()Get the upload timeout.
return uploadTimeout;
|
public static java.lang.String | getWebAppRootPath()Return the folder's root where application are deployed.
return rootFolder;
|
protected void | handleAccept(java.nio.channels.SelectionKey key)Handle OP_ACCEPT
ServerSocketChannel server = (ServerSocketChannel) key.channel();
SocketChannel channel = server.accept();
if (enableNioLogging){
logger.log(Level.INFO,"Handling OP_ACCEPT on SocketChannel " +
channel);
}
if (channel != null) {
if ( multiSelectorsCount > 1 ) {
MultiSelectorThread srt = getSelectorReadThread();
srt.addChannel(channel);
} else {
channel.configureBlocking(false);
SelectionKey readKey =
channel.register(selector, SelectionKey.OP_READ);
setSocketOptions(((SocketChannel)readKey.channel()).socket());
readKey.attach(System.currentTimeMillis());
}
if (isMonitoringEnabled()) {
getRequestGroupInfo().increaseCountOpenConnections();
pipelineStat.incrementTotalAcceptCount();
}
}
|
protected void | handleConnection(java.nio.channels.SelectionKey key)Handle an incoming operation on the channel. It is always an ACCEPT or
a READ.
Task task = null;
if ((key.readyOps() & SelectionKey.OP_ACCEPT) == SelectionKey.OP_ACCEPT){
handleAccept(key);
return;
} else if ((key.readyOps() & SelectionKey.OP_READ)
== SelectionKey.OP_READ) {
task = handleRead(key);
}
if ( ((SocketChannel)key.channel()).isOpen() ) {
task.execute();
} else {
cancelKey(key);
}
|
protected ReadTask | handleRead(java.nio.channels.SelectionKey key)Handle OP_READ
// disable OP_READ on key before doing anything else
key.interestOps(key.interestOps() & (~SelectionKey.OP_READ));
if (enableNioLogging){
logger.log(Level.INFO,"Handling OP_READ on SocketChannel " +
key.channel());
}
Object attach = key.attachment();
if (!defaultAlgorithmInstalled) {
if (key.isValid() && attach != null && attach instanceof ReadTask){
key.attach(null);
return (ReadTask)attach;
}
}
return getReadTask(key);
|
protected void | initAlgorithm()Load using reflection the Algorithm class.
try{
if (classLoader == null){
algorithmClass = Class.forName(algorithmClassName);
} else {
algorithmClass = classLoader.loadClass(algorithmClassName);
}
logger.log(Level.FINE,
"Using Algorithm: " + algorithmClassName);
} catch (ClassNotFoundException ex){
logger.log(Level.FINE,
"Unable to load Algorithm: " + algorithmClassName);
} finally {
if ( algorithmClass == null ){
algorithmClass = NoParsingAlgorithm.class;
}
}
defaultAlgorithmInstalled =
algorithmClassName.equals(DEFAULT_ALGORITHM) ? true:false;
|
public void | initEndpoint()initialized the endpoint by creating the ServerScoketChannel
and by initializing the server socket.
SelectorThreadConfig.configure(this);
initFileCacheFactory();
initAlgorithm();
initPipeline();
initMonitoringLevel();
setName("SelectorThread-" + port);
try{
// Create the socket listener
serverSocketChannel = ServerSocketChannel.open();
selector = Selector.open();
serverSocket = serverSocketChannel.socket();
serverSocket.setReuseAddress(reuseAddress);
if ( inet == null)
serverSocket.bind(new InetSocketAddress(port),ssBackLog);
else
serverSocket.bind(new InetSocketAddress(inet,port),ssBackLog);
serverSocketChannel.configureBlocking(false);
serverSocketChannel.register(selector, SelectionKey.OP_ACCEPT);
} catch (SocketException ex){
throw new BindException(ex.getMessage() + ": " + port);
}
serverSocket.setSoTimeout(serverTimeout);
if ( multiSelectorsCount > 1 ){
readThreads = new MultiSelectorThread[multiSelectorsCount];
initMultiSelectors();
}
initProcessorTask(maxProcessorWorkerThreads);
initReadTask(minReadQueueLength);
SelectorFactory.maxSelectors = maxProcessorWorkerThreads;
initialized = true;
logger.log(Level.FINE,"Initializing Grizzly Non-Blocking Mode");
|
protected void | initFileCacheFactory()Initialize the fileCacheFactory associated with this instance
if (asyncExecution){
isFileCacheEnabled = false;
isLargeFileCacheEnabled = false;
}
fileCacheFactory = FileCacheFactory.getFactory(port);
fileCacheFactory.setIsEnabled(isFileCacheEnabled);
fileCacheFactory.setLargeFileCacheEnabled(isLargeFileCacheEnabled);
fileCacheFactory.setSecondsMaxAge(secondsMaxAge);
fileCacheFactory.setMaxCacheEntries(maxCacheEntries);
fileCacheFactory.setMinEntrySize(minEntrySize);
fileCacheFactory.setMaxEntrySize(maxEntrySize);
fileCacheFactory.setMaxLargeCacheSize(maxLargeFileCacheSize);
fileCacheFactory.setMaxSmallCacheSize(maxSmallFileCacheSize);
fileCacheFactory.setIsMonitoringEnabled(isMonitoringEnabled);
fileCacheFactory.setHeaderBBSize(requestBufferSize);
|
protected void | initKeepAlivePipeline()Initialize the keep-alive mechanism.
keepAlivePipeline = new KeepAlivePipeline();
keepAlivePipeline.setMaxKeepAliveRequests(maxKeepAliveRequests);
keepAlivePipeline
.setKeepAliveTimeoutInSeconds(keepAliveTimeoutInSeconds);
keepAlivePipeline.setPort(port);
keepAlivePipeline.setThreadsTimeout(threadsTimeout);
keepAliveStats.setMaxConnections(maxKeepAliveRequests);
keepAliveStats.setSecondsTimeouts(keepAliveTimeoutInSeconds);
|
protected void | initMonitoringLevel()
pipelineStat = new PipelineStatistic(port);
pipelineStat.setQueueSizeInBytes(maxQueueSizeInBytes);
|
protected void | initMultiSelectors()Initialize SelectorReadThread used to process
OP_READ operations.
for (int i = 0; i < readThreads.length; i++) {
readThreads[i] = new SelectorReadThread();
((SelectorReadThread)readThreads[i]).countName = i;
configureReadThread((SelectorReadThread)readThreads[i]);
}
curReadThread = 0;
|
protected void | initPipeline()Init the Pipeline s used by the WorkerThread s.
selectorThreads.put(port,this);
initKeepAlivePipeline();
processorPipeline = newPipeline(maxProcessorWorkerThreads,
minWorkerThreads, "http",
port,Thread.MAX_PRIORITY);
processorPipeline.initPipeline();
if ( maxReadWorkerThreads == 0){
maxReadWorkerThreads = -1;
logger.log(Level.WARNING,
"http-listener " + port +
" is security-enabled and needs at least 2 threads");
}
// Only creates the pipeline if the max > 0, and the async mechanism
// must not be enabled.
if ( maxReadWorkerThreads > 0 && !asyncExecution){
readPipeline = newPipeline(maxReadWorkerThreads,
minWorkerThreads, "read",
port,Thread.NORM_PRIORITY);
readPipeline.initPipeline();
} else {
readPipeline = (maxReadWorkerThreads == 0 ? null:processorPipeline);
}
|
protected void | initProcessorTask(int size)Create a pool of ProcessorTask
for (int i=0; i < size; i++){
processorTasks.offer(newProcessorTask(false));
}
|
protected void | initReadTask(int size)Create a pool of ReadTask
ReadTask task;
for (int i=0; i < size; i++){
task = newReadTask();
readTasks.offer(task);
}
|
public boolean | isBufferResponse()
return bufferResponse;
|
public boolean | isDisplayConfiguration()
return displayConfiguration;
|
public boolean | isEnableNioLogging()
return enableNioLogging;
|
public boolean | isFileCacheEnabled()Is the fileCache enabled.
return isFileCacheEnabled;
|
public boolean | isInitialized()
return initialized;
|
public boolean | isIsMonitoringEnabled()
return isMonitoringEnabled;
|
public boolean | isMonitoringEnabled()Returns true if monitoring has been enabled,
false otherwise.
return isMonitoringEnabled;
|
public boolean | isRecycleTasks()
return recycleTasks;
|
public boolean | isRunning()
return running;
|
public boolean | isTcpNoDelay()
return tcpNoDelay;
|
public boolean | isUseByteBufferView()
return useByteBufferView;
|
public boolean | isUseDirectByteBuffer()
return useDirectByteBuffer;
|
public static java.util.logging.Logger | logger()Return the logger used by the Grizzly classes.
return logger;
|
protected Pipeline | newPipeline(int maxThreads, int minThreads, java.lang.String name, int port, int priority)Create a new Pipeline instance using the
pipelineClassName value.
Class className = null;
Pipeline pipeline = null;
try{
if ( classLoader == null ){
className = Class.forName(pipelineClassName);
} else {
className = classLoader.loadClass(pipelineClassName);
}
pipeline = (Pipeline)className.newInstance();
} catch (ClassNotFoundException ex){
logger.log(Level.WARNING,
"Unable to load Pipeline: " + pipelineClassName);
pipeline = new LinkedListPipeline();
} catch (InstantiationException ex){
logger.log(Level.WARNING,
"Unable to instantiate Pipeline: "
+ pipelineClassName);
pipeline = new LinkedListPipeline();
} catch (IllegalAccessException ex){
logger.log(Level.WARNING,
"Unable to instantiate Pipeline: "
+ pipelineClassName);
pipeline = new LinkedListPipeline();
}
if (logger.isLoggable(Level.FINE)){
logger.log(Level.FINE,
"http-listener " + port + " uses pipeline: "
+ pipeline.getClass().getName());
}
pipeline.setMaxThreads(maxThreads);
pipeline.setMinThreads(minThreads);
pipeline.setName(name);
pipeline.setPort(port);
pipeline.setPriority(priority);
pipeline.setQueueSizeInBytes(maxQueueSizeInBytes);
pipeline.setThreadsIncrement(threadsIncrement);
pipeline.setThreadsTimeout(threadsTimeout);
return pipeline;
|
protected ProcessorTask | newProcessorTask(boolean initialize)Create ProcessorTask objects and configure it to be ready
to proceed request.
DefaultProcessorTask task =
new DefaultProcessorTask(initialize, bufferResponse);
return configureProcessorTask(task);
|
protected ReadTask | newReadTask()Return a new ReadTask instance
StreamAlgorithm streamAlgorithm = null;
try{
streamAlgorithm = (StreamAlgorithm)algorithmClass.newInstance();
} catch (InstantiationException ex){
logger.log(Level.WARNING,
"Unable to instantiate Algorithm: "+ algorithmClassName);
} catch (IllegalAccessException ex){
logger.log(Level.WARNING,
"Unable to instantiate Algorithm: " + algorithmClassName);
} finally {
if ( streamAlgorithm == null)
streamAlgorithm = new NoParsingAlgorithm();
}
streamAlgorithm.setPort(port);
ReadTask task = null;
/**
* For performance reason, we need to avoid calling newInstance() when
* the default configuration is used.
*/
if ( !defaultAlgorithmInstalled ) {
try{
task = (ReadTask)streamAlgorithm.getReadTask(this).newInstance();
} catch (InstantiationException ex){
logger.log(Level.WARNING,
"Unable to instantiate Algorithm: "
+ algorithmClassName);
} catch (IllegalAccessException ex){
logger.log(Level.WARNING,
"Unable to instantiate Algorithm: "
+ algorithmClassName);
} finally {
if ( task == null)
task = new DefaultReadTask();
}
} else if ( maxReadWorkerThreads > 0 || asyncExecution ){
task = new AsyncReadTask();
} else {
task = new DefaultReadTask();
}
task.setSelectorThread(this);
task.setPipeline(readPipeline);
task.setRecycle(recycleTasks);
task.initialize(streamAlgorithm, useDirectByteBuffer,useByteBufferView);
return task;
|
public void | postDeregister()
// Do nothing
|
public void | postRegister(java.lang.Boolean registrationDone)
// Do nothing
|
public void | preDeregister()
// Do nothing
|
public javax.management.ObjectName | preRegister(javax.management.MBeanServer server, javax.management.ObjectName name)
oname=name;
mserver=server;
domain=name.getDomain();
return name;
|
protected void | rampUpProcessorTask()Initialize ProcessorTask
Iterator<ProcessorTask> iterator = processorTasks.iterator();
while (iterator.hasNext()) {
iterator.next().initialize();
}
|
protected void | reconfigureAsyncExecution()Reconfigure Grizzly Asynchronous Request Processing(ARP) internal
objects.
for(ProcessorTask task :processorTasks){
if (task instanceof DefaultProcessorTask) {
((DefaultProcessorTask)task)
.setEnableAsyncExecution(asyncExecution);
((DefaultProcessorTask)task).setAsyncHandler(asyncHandler);
}
}
readTasks.clear();
initReadTask(minReadQueueLength);
|
protected void | registerComponents()Register JMX components.
if( this.domain != null && jmxManagement != null) {
try {
globalRequestProcessorName = new ObjectName(
domain + ":type=GlobalRequestProcessor,name=http" + port);
jmxManagement.registerComponent(globalRequestProcessor,
globalRequestProcessorName,
null);
keepAliveMbeanName = new ObjectName(
domain + ":type=PWCKeepAlive,name=http" + port);
jmxManagement.registerComponent(keepAliveStats,
keepAliveMbeanName,
null);
pwcConnectionQueueMbeanName = new ObjectName(
domain + ":type=PWCConnectionQueue,name=http" + port);
jmxManagement.registerComponent(pipelineStat,
pwcConnectionQueueMbeanName,
null);
pwcFileCacheMbeanName = new ObjectName(
domain + ":type=PWCFileCache,name=http" + port);
jmxManagement.registerComponent(fileCacheFactory,
pwcFileCacheMbeanName,
null);
} catch (Exception ex) {
logger.log(Level.WARNING,
"selectorThread.mbeanRegistrationException",
new Object[]{new Integer(port),ex});
}
}
|
public void | registerKey(java.nio.channels.SelectionKey key)Register a SelectionKey to this Selector
running of this thread.
if (key == null) return;
if (keepAlivePipeline.dropConnection()) {
cancelKey(key);
return;
}
if (defaultAlgorithmInstalled){
key.attach(null);
}
if (enableNioLogging){
logger.log(Level.INFO,
"Registering SocketChannel for keep alive " +
key.channel());
}
// add SelectionKey & Op to list of Ops to enable
keysToEnable.add(key);
// tell the Selector Thread there's some ops to enable
selector.wakeup();
// wakeup() will force the SelectorThread to bail out
// of select() to process your registered request
|
public void | removeCacheEntry(java.lang.String contextPath)Remove a context path from the FileCache .
ConcurrentHashMap<String,FileCacheEntry>
cachedEntries = fileCacheFactory.getCache();
if ( cachedEntries == null){
return;
}
Iterator<String> iterator = cachedEntries.keySet().iterator();
String cachedPath;
while (iterator.hasNext()){
cachedPath = iterator.next();
if ( cachedPath.startsWith(contextPath) ){
cachedEntries.remove(cachedPath).run();
}
}
|
public void | returnTask(Task task)Returns the Task object to the pool.
// Returns the object to the pool.
if (task != null) {
if (task.getType() == Task.PROCESSOR_TASK){
if ( isMonitoringEnabled() ){
activeProcessorTasks.remove(((DefaultProcessorTask)task));
}
processorTasks.offer((DefaultProcessorTask)task);
} else if (task.getType() == Task.READ_TASK){
readTasks.offer((ReadTask)task);
}
}
|
public void | run()Start the endpoint (this)
try{
startEndpoint();
} catch (Exception ex){
logger.log(Level.SEVERE,"selectorThread.errorOnRequest", ex);
}
|
public void | setActiveProcessorTasks(java.util.concurrent.ConcurrentLinkedQueue activeProcessorTasks)
this.activeProcessorTasks = activeProcessorTasks;
|
public void | setAdapter(org.apache.coyote.Adapter adapter)Set the associated adapter.
this.adapter = adapter;
|
public void | setAddress(java.net.InetAddress inet)
this.inet=inet;
|
public void | setAlgorithmClass(java.lang.Class algorithmClass)
this.algorithmClass = algorithmClass;
|
public void | setAlgorithmClassName(java.lang.String algorithmClassName)
this.algorithmClassName = algorithmClassName;
|
public void | setAsyncHandler(AsyncHandler asyncHandler)Set the AsyncHandler used when asynchronous execution is
enabled.
this.asyncHandler = asyncHandler;
|
public void | setBufferResponse(boolean bufferResponse)true if the reponse willk be buffered.
this.bufferResponse = bufferResponse;
|
public void | setBufferSize(int requestBufferSize)Set the request input buffer size
this.requestBufferSize = requestBufferSize;
|
public void | setClassLoader(java.lang.ClassLoader classLoader)Set the ClassLoader used to load configurable
classes (Pipeline, StreamAlgorithm).
this.classLoader = classLoader;
|
public void | setCompressableMimeTypes(java.lang.String compressableMimeTypes)
this.compressableMimeTypes = compressableMimeTypes;
|
public void | setCompression(java.lang.String compression)
this.compression = compression;
|
public void | setCompressionMinSize(int compressionMinSize)
this.compressionMinSize = compressionMinSize;
|
public void | setCurReadThread(int curReadThread)
this.curReadThread = curReadThread;
|
public void | setCurrentConnectionNumber(int currentConnectionNumber)
this.currentConnectionNumber = currentConnectionNumber;
|
public void | setDefaultResponseType(java.lang.String defaultResponseType)
this.defaultResponseType = defaultResponseType;
|
public void | setDisableUploadTimeout(boolean isDisabled)Set the flag to control upload time-outs.
disableUploadTimeout = isDisabled;
|
public void | setDisplayConfiguration(boolean displayConfiguration)
this.displayConfiguration = displayConfiguration;
|
public void | setDomain(java.lang.String domain)
this.domain = domain;
|
public void | setEnableAsyncExecution(boolean asyncExecution)Enable the AsyncHandler used when asynchronous
this.asyncExecution = asyncExecution;
if (running){
reconfigureAsyncExecution();
}
|
public void | setEnableNioLogging(boolean enableNioLogging)
this.enableNioLogging = enableNioLogging;
|
public void | setFileCacheIsEnabled(boolean isFileCacheEnabled)Is the file caching mechanism enabled.
this.isFileCacheEnabled = isFileCacheEnabled;
|
public void | setForcedRequestType(java.lang.String forcedRequestType)
this.forcedRequestType = forcedRequestType;
|
public void | setGlobalRequestProcessor(org.apache.coyote.RequestGroupInfo globalRequestProcessor)
this.globalRequestProcessor = globalRequestProcessor;
|
public void | setGlobalRequestProcessorName(javax.management.ObjectName globalRequestProcessorName)
this.globalRequestProcessorName = globalRequestProcessorName;
|
public void | setInet(java.net.InetAddress inet)
this.inet = inet;
|
public void | setInitialized(boolean initialized)
this.initialized = initialized;
|
public void | setIsMonitoringEnabled(boolean isMonitoringEnabled)
this.isMonitoringEnabled = isMonitoringEnabled;
|
public void | setIsWaiting(boolean isWaiting)
this.isWaiting = isWaiting;
|
public void | setKaTimeout(int kaTimeout)
this.kaTimeout = kaTimeout;
|
public void | setKeepAliveMbeanName(javax.management.ObjectName keepAliveMbeanName)
this.keepAliveMbeanName = keepAliveMbeanName;
|
public void | setKeepAlivePipeline(KeepAlivePipeline keepAlivePipeline)
this.keepAlivePipeline = keepAlivePipeline;
|
public void | setKeepAliveStats(KeepAliveStats keepAliveStats)
this.keepAliveStats = keepAliveStats;
|
public void | setKeepAliveThreadCount(int threadCount)Sets the number of keep-alive threads.
keepAlivePipeline.setMaxThreads(threadCount);
|
public void | setKeepAliveTimeoutInSeconds(int timeout)Sets the number of seconds before a keep-alive connection that has
been idle times out and is closed.
keepAliveTimeoutInSeconds = timeout;
keepAliveStats.setSecondsTimeouts(timeout);
|
public void | setKeysToEnable(java.util.concurrent.ConcurrentLinkedQueue keysToEnable)
this.keysToEnable = keysToEnable;
|
public void | setLargeFileCacheEnabled(boolean isLargeEnabled)Is the large file cache support enabled.
this.isLargeFileCacheEnabled = isLargeEnabled;
|
public void | setLinger(int linger)
this.linger = linger;
|
public static void | setLogger(java.util.logging.Logger l)Set the logger used by this instance.
if ( l != null )
logger = l;
|
public void | setManagement(Management jmxManagement)
this.jmxManagement = jmxManagement;
|
public void | setMaxCacheEntries(int mEntries)Set the maximum entries this cache can contains.
maxCacheEntries = mEntries;
|
public void | setMaxEntrySize(long mEntrySize)Set the maximum size a FileCacheEntry can have.
maxEntrySize = mEntrySize;
|
public void | setMaxHttpHeaderSize(int maxHttpHeaderSize)
this.maxHttpHeaderSize = maxHttpHeaderSize;
|
public void | setMaxKeepAliveRequests(int mkar)Set the maximum number of Keep-Alive requests that we will honor.
maxKeepAliveRequests = mkar;
|
public void | setMaxLargeCacheSize(long mCacheSize)Set the maximum cache size
maxLargeFileCacheSize = mCacheSize;
|
public void | setMaxPostSize(int maxPostSize)
this.maxPostSize = maxPostSize;
|
public void | setMaxProcessorWorkerThreads(int maxProcessorWorkerThreads)
this.maxProcessorWorkerThreads = maxProcessorWorkerThreads;
|
public void | setMaxQueueSizeInBytes(int maxQueueSizeInBytes)
this.maxQueueSizeInBytes = maxQueueSizeInBytes;
|
public void | setMaxReadWorkerThreads(int maxReadWorkerThreads)
this.maxReadWorkerThreads = maxReadWorkerThreads;
|
public void | setMaxSmallCacheSize(long mCacheSize)Set the maximum cache size
maxSmallFileCacheSize = mCacheSize;
|
public void | setMaxSpareThreads(int maxThreads)
|
public void | setMaxThreads(int maxThreads)
if ( maxThreads == 1 ) {
maxProcessorWorkerThreads = 5;
} else {
maxProcessorWorkerThreads = maxThreads;
}
|
public void | setMinEntrySize(long mSize)Set the maximum size a FileCacheEntry can have.
minEntrySize = mSize;
|
public void | setMinProcessorQueueLength(int minProcessorQueueLength)
this.minProcessorQueueLength = minProcessorQueueLength;
|
public void | setMinReadQueueLength(int minReadQueueLength)
this.minReadQueueLength = minReadQueueLength;
|
public void | setMinSpareThreads(int minSpareThreads)
this.minSpareThreads = minSpareThreads;
|
public void | setMinThreads(int minWorkerThreads)The minimun threads created at startup.
this.minWorkerThreads = minWorkerThreads;
|
public void | setMinWorkerThreads(int minWorkerThreads)
this.minWorkerThreads = minWorkerThreads;
|
public void | setMserver(javax.management.MBeanServer mserver)
this.mserver = mserver;
|
public void | setNextKeysExpiration(long nextKeysExpiration)
this.nextKeysExpiration = nextKeysExpiration;
|
public void | setNoCompressionUserAgents(java.lang.String noCompressionUserAgents)
this.noCompressionUserAgents = noCompressionUserAgents;
|
public void | setOname(javax.management.ObjectName oname)
this.oname = oname;
|
public void | setPipelineClassName(java.lang.String pipelineClassName)
this.pipelineClassName = pipelineClassName;
|
public void | setPipelineStat(PipelineStatistic pipelineStat)
this.pipelineStat = pipelineStat;
|
public void | setPort(int port)
this.port=port;
|
public void | setProcessorPipeline(Pipeline processorPipeline)
this.processorPipeline = processorPipeline;
|
public void | setProcessorTasks(java.util.concurrent.ConcurrentLinkedQueue processorTasks)
this.processorTasks = processorTasks;
|
public void | setProcessorWorkerThreadName(javax.management.ObjectName processorWorkerThreadName)
this.processorWorkerThreadName = processorWorkerThreadName;
|
public void | setPwcConnectionQueueMbeanName(javax.management.ObjectName pwcConnectionQueueMbeanName)
this.pwcConnectionQueueMbeanName = pwcConnectionQueueMbeanName;
|
public void | setPwcFileCacheMbeanName(javax.management.ObjectName pwcFileCacheMbeanName)
this.pwcFileCacheMbeanName = pwcFileCacheMbeanName;
|
public void | setReadPipeline(Pipeline readPipeline)
this.readPipeline = readPipeline;
|
public void | setReadTasks(java.util.concurrent.ConcurrentLinkedQueue readTasks)
this.readTasks = readTasks;
|
public void | setRecycleTasks(boolean recycleTasks)
this.recycleTasks = recycleTasks;
|
public void | setRestrictedUserAgents(java.lang.String restrictedUserAgents)
this.restrictedUserAgents = restrictedUserAgents;
|
public void | setReuseAddress(boolean reuseAddress)
this.reuseAddress = reuseAddress;
|
public static void | setRootFolder(java.lang.String aRootFolder)
rootFolder = aRootFolder;
|
public void | setRunning(boolean running)
this.running = running;
|
public void | setSecondsMaxAge(int sMaxAges)The timeout in seconds before remove a FileCacheEntry
from the fileCache
secondsMaxAge = sMaxAges;
|
public void | setSelector(java.nio.channels.Selector selector)
this.selector = selector;
|
public void | setSelectorReadThreadsCount(int multiSelectorsCount)
this.multiSelectorsCount = multiSelectorsCount;
|
public static void | setSelectorTimeout(int aSelectorTimeout)
selectorTimeout = aSelectorTimeout;
|
public void | setServerSoTimeout(int i)
serverTimeout=i;
|
public void | setServerSocket(java.net.ServerSocket serverSocket)
this.serverSocket = serverSocket;
|
public void | setServerSocketChannel(java.nio.channels.ServerSocketChannel serverSocketChannel)
this.serverSocketChannel = serverSocketChannel;
|
public void | setServerTimeout(int timeout)Sets the timeout in ms of the server sockets created by this
server. This method allows the developer to make servers
more or less responsive to having their server sockets
shut down.
By default this value is 1000ms.
this.serverTimeout = timeout;
|
public void | setSoLinger(int i)
linger=i;
|
public void | setSoTimeout(int i)
socketTimeout=i;
|
protected void | setSocketOptions(java.net.Socket socket)
try{
if(linger >= 0 ) {
socket.setSoLinger( true, linger);
}
} catch (SocketException ex){
logger.log(Level.WARNING,
"setSoLinger exception ",ex);
}
try{
if( tcpNoDelay )
socket.setTcpNoDelay(tcpNoDelay);
} catch (SocketException ex){
logger.log(Level.WARNING,
"setTcpNoDelay exception ",ex);
}
try{
if ( maxReadWorkerThreads != 0)
socket.setReuseAddress(reuseAddress);
} catch (SocketException ex){
logger.log(Level.WARNING,
"setReuseAddress exception ",ex);
}
try{
if(oOBInline){
socket.setOOBInline(oOBInline);
}
} catch (SocketException ex){
logger.log(Level.WARNING,
"setOOBInline exception ",ex);
}
|
public void | setSocketTimeout(int socketTimeout)
this.socketTimeout = socketTimeout;
|
public void | setSsBackLog(int ssBackLog)
this.ssBackLog = ssBackLog;
|
public void | setTcpNoDelay(boolean b)
tcpNoDelay=b;
|
public void | setThreadsIncrement(int threadsIncrement)
this.threadsIncrement = threadsIncrement;
|
public void | setThreadsTimeout(int threadsTimeout)
this.threadsTimeout = threadsTimeout;
|
public void | setUploadTimeout(int uploadTimeout)Set the upload timeout.
this.uploadTimeout = uploadTimeout ;
|
public void | setUseByteBufferView(boolean useByteBufferView)
this.useByteBufferView = useByteBufferView;
|
public void | setUseDirectByteBuffer(boolean useDirectByteBuffer)
this.useDirectByteBuffer = useDirectByteBuffer;
|
public static void | setWebAppRootPath(java.lang.String rf)Set the document root folder
rootFolder = rf;
|
public void | startEndpoint()Start the Acceptor Thread and wait for incoming connection, in a non
blocking mode.
running = true;
kaTimeout = keepAliveTimeoutInSeconds * 1000;
rampUpProcessorTask();
registerComponents();
displayConfiguration();
startPipelines();
startListener();
|
protected void | startListener()Start a non blocking Selector object.
synchronized(lock){
while (running && selector.isOpen()) {
doSelect();
}
try{
closeActiveConnections();
stopPipelines();
stopSelectorReadThread();
try{
if ( serverSocket != null )
serverSocket.close();
} catch (Throwable ex){
logger.log(Level.SEVERE,
"selectorThread.closeSocketException",ex);
}
try{
if ( serverSocketChannel != null)
serverSocketChannel.close();
} catch (Throwable ex){
logger.log(Level.SEVERE,
"selectorThread.closeSocketException",ex);
}
try{
if ( selector != null)
selector.close();
} catch (Throwable ex){
logger.log(Level.SEVERE,
"selectorThread.closeSocketException",ex);
}
unregisterComponents();
} catch (Throwable t){
logger.log(Level.SEVERE,"selectorThread.stopException",t);
}
}
|
protected void | startPipelines()Starts the Pipeline used by this Selector
if (readPipeline != null){
readPipeline.startPipeline();
}
processorPipeline.startPipeline();
|
public void | stopEndpoint()
if (!running) return;
running = false;
synchronized(lock){
// Wait for the main thread to stop.
clearTasks();
}
|
protected void | stopPipelines()Stop the Pipeline used by this Selector
if ( keepAlivePipeline != null )
keepAlivePipeline.stopPipeline();
if (readPipeline != null){
readPipeline.stopPipeline();
}
processorPipeline.stopPipeline();
|
private void | stopSelectorReadThread()Stop the extra SelectorReadThread
if ( readThreads != null ){
for (int i = 0; i < readThreads.length; i++) {
readThreads[i].stopEndpoint();
}
}
|
protected void | unregisterComponents()Unregister components.
if (this.domain != null && jmxManagement != null) {
try {
if (globalRequestProcessorName != null) {
jmxManagement.unregisterComponent(globalRequestProcessorName);
}
if (keepAliveMbeanName != null) {
jmxManagement.unregisterComponent(keepAliveMbeanName);
}
if (pwcConnectionQueueMbeanName != null) {
jmxManagement.unregisterComponent(pwcConnectionQueueMbeanName);
}
if (pwcFileCacheMbeanName != null) {
jmxManagement.unregisterComponent(pwcFileCacheMbeanName);
}
} catch (Exception ex) {
logger.log(Level.WARNING,
"mbeanDeregistrationException",
new Object[]{new Integer(port),ex});
}
}
|
public void | wakeup()Wakes up the Selector associated with this thread.
selector.wakeup();
|