Package org.apache.catalina.core
Class StandardThreadExecutor
- java.lang.Object
- 
- org.apache.catalina.util.LifecycleBase
- 
- org.apache.catalina.util.LifecycleMBeanBase
- 
- org.apache.catalina.core.StandardThreadExecutor
 
 
 
- 
- All Implemented Interfaces:
- java.util.concurrent.Executor,- javax.management.MBeanRegistration,- Executor,- JmxEnabled,- Lifecycle,- ResizableExecutor
 
 public class StandardThreadExecutor extends LifecycleMBeanBase implements Executor, ResizableExecutor 
- 
- 
Nested Class Summary- 
Nested classes/interfaces inherited from interface org.apache.catalina.LifecycleLifecycle.SingleUse
 
- 
 - 
Field SummaryFields Modifier and Type Field Description protected booleandaemonRun threads in daemon or non-daemon stateprotected ThreadPoolExecutorexecutorThe executor we use for this componentprotected intmaxIdleTimeidle time in millisecondsprotected intmaxQueueSizeThe maximum number of elements that can queue up before we reject themprotected intmaxThreadsmax number of threadsprotected intminSpareThreadsmin number of threadsprotected java.lang.Stringnamethe name of this thread poolprotected java.lang.StringnamePrefixDefault name prefix for the thread nameprotected static StringManagersmprotected intthreadPriorityDefault thread priorityprotected longthreadRenewalDelayAfter a context is stopped, threads in the pool are renewed.- 
Fields inherited from class org.apache.catalina.util.LifecycleMBeanBasemserver
 - 
Fields inherited from interface org.apache.catalina.LifecycleAFTER_DESTROY_EVENT, AFTER_INIT_EVENT, AFTER_START_EVENT, AFTER_STOP_EVENT, BEFORE_DESTROY_EVENT, BEFORE_INIT_EVENT, BEFORE_START_EVENT, BEFORE_STOP_EVENT, CONFIGURE_START_EVENT, CONFIGURE_STOP_EVENT, PERIODIC_EVENT, START_EVENT, STOP_EVENT
 
- 
 - 
Constructor SummaryConstructors Constructor Description StandardThreadExecutor()
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidcontextStopping()voidexecute(java.lang.Runnable command)voidexecute(java.lang.Runnable command, long timeout, java.util.concurrent.TimeUnit unit)Deprecated.intgetActiveCount()Returns the approximate number of threads that are actively executing tasks.longgetCompletedTaskCount()intgetCorePoolSize()protected java.lang.StringgetDomainInternal()Method implemented by sub-classes to identify the domain in which MBeans should be registered.intgetLargestPoolSize()intgetMaxIdleTime()intgetMaxQueueSize()intgetMaxThreads()intgetMinSpareThreads()java.lang.StringgetName()java.lang.StringgetNamePrefix()protected java.lang.StringgetObjectNameKeyProperties()Allow sub-classes to specify the key properties component of theObjectNamethat will be used to register this component.intgetPoolSize()Returns the current number of threads in the pool.intgetQueueSize()intgetThreadPriority()longgetThreadRenewalDelay()booleanisDaemon()booleanresizePool(int corePoolSize, int maximumPoolSize)booleanresizeQueue(int capacity)voidsetDaemon(boolean daemon)voidsetMaxIdleTime(int maxIdleTime)voidsetMaxQueueSize(int size)voidsetMaxThreads(int maxThreads)voidsetMinSpareThreads(int minSpareThreads)voidsetName(java.lang.String name)voidsetNamePrefix(java.lang.String namePrefix)voidsetThreadPriority(int threadPriority)voidsetThreadRenewalDelay(long threadRenewalDelay)protected voidstartInternal()Start the component and implement the requirements ofLifecycleBase.startInternal().protected voidstopInternal()Stop the component and implement the requirements ofLifecycleBase.stopInternal().- 
Methods inherited from class org.apache.catalina.util.LifecycleMBeanBasedestroyInternal, getDomain, getObjectName, initInternal, postDeregister, postRegister, preDeregister, preRegister, register, setDomain, unregister
 - 
Methods inherited from class org.apache.catalina.util.LifecycleBaseaddLifecycleListener, destroy, findLifecycleListeners, fireLifecycleEvent, getState, getStateName, getThrowOnFailure, init, removeLifecycleListener, setState, setState, setThrowOnFailure, start, stop
 - 
Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 - 
Methods inherited from interface org.apache.catalina.LifecycleaddLifecycleListener, destroy, findLifecycleListeners, getState, getStateName, init, removeLifecycleListener, start, stop
 
- 
 
- 
- 
- 
Field Detail- 
smprotected static final StringManager sm 
 - 
threadPriorityprotected int threadPriority Default thread priority
 - 
daemonprotected boolean daemon Run threads in daemon or non-daemon state
 - 
namePrefixprotected java.lang.String namePrefix Default name prefix for the thread name
 - 
maxThreadsprotected int maxThreads max number of threads
 - 
minSpareThreadsprotected int minSpareThreads min number of threads
 - 
maxIdleTimeprotected int maxIdleTime idle time in milliseconds
 - 
executorprotected ThreadPoolExecutor executor The executor we use for this component
 - 
nameprotected java.lang.String name the name of this thread pool
 - 
maxQueueSizeprotected int maxQueueSize The maximum number of elements that can queue up before we reject them
 - 
threadRenewalDelayprotected long threadRenewalDelay After a context is stopped, threads in the pool are renewed. To avoid renewing all threads at the same time, this delay is observed between 2 threads being renewed.
 
- 
 - 
Method Detail- 
startInternalprotected void startInternal() throws LifecycleExceptionStart the component and implement the requirements ofLifecycleBase.startInternal().- Specified by:
- startInternalin class- LifecycleBase
- Throws:
- LifecycleException- if this component detects a fatal error that prevents this component from being used
 
 - 
stopInternalprotected void stopInternal() throws LifecycleExceptionStop the component and implement the requirements ofLifecycleBase.stopInternal().- Specified by:
- stopInternalin class- LifecycleBase
- Throws:
- LifecycleException- if this component detects a fatal error that needs to be reported
 
 - 
execute@Deprecated public void execute(java.lang.Runnable command, long timeout, java.util.concurrent.TimeUnit unit)Deprecated.Description copied from interface:ExecutorExecutes the given command at some time in the future. The command may execute in a new thread, in a pooled thread, or in the calling thread, at the discretion of theExecutorimplementation. If no threads are available, it will be added to the work queue. If the work queue is full, the system will wait for the specified time until it throws a RejectedExecutionException
 - 
executepublic void execute(java.lang.Runnable command) - Specified by:
- executein interface- java.util.concurrent.Executor
 
 - 
contextStoppingpublic void contextStopping() 
 - 
getThreadPrioritypublic int getThreadPriority() 
 - 
isDaemonpublic boolean isDaemon() 
 - 
getNamePrefixpublic java.lang.String getNamePrefix() 
 - 
getMaxIdleTimepublic int getMaxIdleTime() 
 - 
getMaxThreadspublic int getMaxThreads() - Specified by:
- getMaxThreadsin interface- ResizableExecutor
 
 - 
getMinSpareThreadspublic int getMinSpareThreads() 
 - 
setThreadPrioritypublic void setThreadPriority(int threadPriority) 
 - 
setDaemonpublic void setDaemon(boolean daemon) 
 - 
setNamePrefixpublic void setNamePrefix(java.lang.String namePrefix) 
 - 
setMaxIdleTimepublic void setMaxIdleTime(int maxIdleTime) 
 - 
setMaxThreadspublic void setMaxThreads(int maxThreads) 
 - 
setMinSpareThreadspublic void setMinSpareThreads(int minSpareThreads) 
 - 
setNamepublic void setName(java.lang.String name) 
 - 
setMaxQueueSizepublic void setMaxQueueSize(int size) 
 - 
getMaxQueueSizepublic int getMaxQueueSize() 
 - 
getThreadRenewalDelaypublic long getThreadRenewalDelay() 
 - 
setThreadRenewalDelaypublic void setThreadRenewalDelay(long threadRenewalDelay) 
 - 
getActiveCountpublic int getActiveCount() Description copied from interface:ResizableExecutorReturns the approximate number of threads that are actively executing tasks.- Specified by:
- getActiveCountin interface- ResizableExecutor
- Returns:
- the number of threads
 
 - 
getCompletedTaskCountpublic long getCompletedTaskCount() 
 - 
getCorePoolSizepublic int getCorePoolSize() 
 - 
getLargestPoolSizepublic int getLargestPoolSize() 
 - 
getPoolSizepublic int getPoolSize() Description copied from interface:ResizableExecutorReturns the current number of threads in the pool.- Specified by:
- getPoolSizein interface- ResizableExecutor
- Returns:
- the number of threads
 
 - 
getQueueSizepublic int getQueueSize() 
 - 
resizePoolpublic boolean resizePool(int corePoolSize, int maximumPoolSize)- Specified by:
- resizePoolin interface- ResizableExecutor
 
 - 
resizeQueuepublic boolean resizeQueue(int capacity) - Specified by:
- resizeQueuein interface- ResizableExecutor
 
 - 
getDomainInternalprotected java.lang.String getDomainInternal() Description copied from class:LifecycleMBeanBaseMethod implemented by sub-classes to identify the domain in which MBeans should be registered.- Specified by:
- getDomainInternalin class- LifecycleMBeanBase
- Returns:
- The name of the domain to use to register MBeans.
 
 - 
getObjectNameKeyPropertiesprotected java.lang.String getObjectNameKeyProperties() Description copied from class:LifecycleMBeanBaseAllow sub-classes to specify the key properties component of theObjectNamethat will be used to register this component.- Specified by:
- getObjectNameKeyPropertiesin class- LifecycleMBeanBase
- Returns:
- The string representation of the key properties component of the
          desired ObjectName
 
 
- 
 
-