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:
- Executor,- ExecutorService,- MBeanRegistration,- Executor,- JmxEnabled,- Lifecycle,- ResizableExecutor
public class StandardThreadExecutor
extends LifecycleMBeanBase
implements Executor, ExecutorService, ResizableExecutor
- 
Nested Class SummaryNested classes/interfaces inherited from interface org.apache.catalina.LifecycleLifecycle.SingleUse
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected booleanRun threads in daemon or non-daemon stateprotected ThreadPoolExecutorThe executor we use for this componentprotected intidle time in millisecondsprotected intThe maximum number of elements that can queue up before we reject themprotected intmax number of threadsprotected intmin number of threadsprotected Stringthe name of this thread poolprotected StringDefault name prefix for the thread nameprotected static final StringManagerprotected intDefault thread priorityprotected longAfter a context is stopped, threads in the pool are renewed.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
- 
Method SummaryModifier and TypeMethodDescriptionbooleanawaitTermination(long timeout, TimeUnit unit) voidvoidintReturns the approximate number of threads that are actively executing tasks.longintprotected StringMethod implemented by sub-classes to identify the domain in which MBeans should be registered.intintintintintgetName()protected StringAllow sub-classes to specify the key properties component of theObjectNamethat will be used to register this component.intReturns the current number of threads in the pool.intintlonginvokeAll(Collection<? extends Callable<T>> tasks) invokeAll(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) <T> TinvokeAny(Collection<? extends Callable<T>> tasks) <T> TinvokeAny(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) booleanisDaemon()booleanbooleanbooleanresizePool(int corePoolSize, int maximumPoolSize) booleanresizeQueue(int capacity) voidsetDaemon(boolean daemon) voidsetMaxIdleTime(int maxIdleTime) voidsetMaxQueueSize(int size) voidsetMaxThreads(int maxThreads) voidsetMinSpareThreads(int minSpareThreads) voidvoidsetNamePrefix(String namePrefix) voidsetThreadPriority(int threadPriority) voidsetThreadRenewalDelay(long threadRenewalDelay) voidshutdown()protected voidStart the component and implement the requirements ofLifecycleBase.startInternal().protected voidStop the component and implement the requirements ofLifecycleBase.stopInternal().Future<?><T> Future<T><T> Future<T>Methods inherited from class org.apache.catalina.util.LifecycleMBeanBasedestroyInternal, getDomain, getObjectName, initInternal, postDeregister, postRegister, preDeregister, preRegister, register, setDomain, unregister, unregisterMethods inherited from class org.apache.catalina.util.LifecycleBaseaddLifecycleListener, destroy, findLifecycleListeners, fireLifecycleEvent, getState, getStateName, getThrowOnFailure, init, removeLifecycleListener, setState, setState, setThrowOnFailure, start, stopMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.catalina.LifecycleaddLifecycleListener, destroy, findLifecycleListeners, getState, getStateName, init, removeLifecycleListener, start, stop
- 
Field Details- 
sm
- 
threadPriorityprotected int threadPriorityDefault thread priority
- 
daemonprotected boolean daemonRun threads in daemon or non-daemon state
- 
namePrefixDefault name prefix for the thread name
- 
maxThreadsprotected int maxThreadsmax number of threads
- 
minSpareThreadsprotected int minSpareThreadsmin number of threads
- 
maxIdleTimeprotected int maxIdleTimeidle time in milliseconds
- 
executorThe executor we use for this component
- 
namethe name of this thread pool
- 
maxQueueSizeprotected int maxQueueSizeThe maximum number of elements that can queue up before we reject them
- 
threadRenewalDelayprotected long threadRenewalDelayAfter 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.
 
- 
- 
Constructor Details- 
StandardThreadExecutorpublic StandardThreadExecutor()
 
- 
- 
Method Details- 
startInternalStart 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
 
- 
stopInternalStop 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
- 
contextStoppingpublic void contextStopping()
- 
getThreadPrioritypublic int getThreadPriority()
- 
isDaemonpublic boolean isDaemon()
- 
getNamePrefix
- 
getMaxIdleTimepublic int getMaxIdleTime()
- 
getMaxThreadspublic int getMaxThreads()- Specified by:
- getMaxThreadsin interface- ResizableExecutor
 
- 
getMinSpareThreadspublic int getMinSpareThreads()
- 
getName
- 
setThreadPrioritypublic void setThreadPriority(int threadPriority) 
- 
setDaemonpublic void setDaemon(boolean daemon) 
- 
setNamePrefix
- 
setMaxIdleTimepublic void setMaxIdleTime(int maxIdleTime) 
- 
setMaxThreadspublic void setMaxThreads(int maxThreads) 
- 
setMinSpareThreadspublic void setMinSpareThreads(int minSpareThreads) 
- 
setName
- 
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
 
- 
getDomainInternalDescription 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.
 
- 
getObjectNameKeyPropertiesDescription 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
 
- 
shutdownpublic void shutdown()- Specified by:
- shutdownin interface- ExecutorService
 
- 
shutdownNow- Specified by:
- shutdownNowin interface- ExecutorService
 
- 
isShutdownpublic boolean isShutdown()- Specified by:
- isShutdownin interface- ExecutorService
 
- 
isTerminatedpublic boolean isTerminated()- Specified by:
- isTerminatedin interface- ExecutorService
 
- 
awaitTermination- Specified by:
- awaitTerminationin interface- ExecutorService
- Throws:
- InterruptedException
 
- 
submit- Specified by:
- submitin interface- ExecutorService
 
- 
submit- Specified by:
- submitin interface- ExecutorService
 
- 
submit- Specified by:
- submitin interface- ExecutorService
 
- 
invokeAllpublic <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks) throws InterruptedException - Specified by:
- invokeAllin interface- ExecutorService
- Throws:
- InterruptedException
 
- 
invokeAllpublic <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) throws InterruptedException - Specified by:
- invokeAllin interface- ExecutorService
- Throws:
- InterruptedException
 
- 
invokeAnypublic <T> T invokeAny(Collection<? extends Callable<T>> tasks) throws InterruptedException, ExecutionException - Specified by:
- invokeAnyin interface- ExecutorService
- Throws:
- InterruptedException
- ExecutionException
 
- 
invokeAnypublic <T> T invokeAny(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException - Specified by:
- invokeAnyin interface- ExecutorService
- Throws:
- InterruptedException
- ExecutionException
- TimeoutException
 
 
-