Top Fields Constructors Methods
org.apache.catalina.core

public Class StandardThreadExecutor

extends LifecycleMBeanBase
implements Executor, ResizableExecutor
Class Inheritance
All Implemented Interfaces
org.apache.tomcat.util.threads.ResizableExecutor, java.util.concurrent.Executor, org.apache.catalina.Executor, org.apache.catalina.Lifecycle
Imports
java.util.concurrent.TimeUnit, org.apache.catalina.Executor, .LifecycleException, .LifecycleState, org.apache.catalina.util.LifecycleMBeanBase, org.apache.tomcat.util.res.StringManager, org.apache.tomcat.util.threads.ResizableExecutor, .TaskQueue, .TaskThreadFactory, .ThreadPoolExecutor

Field Summary

Modifier and TypeField and Description
protected boolean
daemon

Run threads in daemon or non-daemon state

protected ThreadPoolExecutor
executor

The executor we use for this component

protected int
maxIdleTime

idle time in milliseconds

protected int
maxQueueSize

The maximum number of elements that can queue up before we reject them

protected int
maxThreads

max number of threads

protected int
minSpareThreads

min number of threads

protected String
name

the name of this thread pool

protected String
namePrefix

Default name prefix for the thread name

protected static final StringManager
private TaskQueue
protected int
threadPriority

Default thread priority

protected long
threadRenewalDelay

After a context is stopped, threads in the pool are renewed.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
public void
execute(Runnable
the runnable task
command
)

Implements java.util.concurrent.Executor.execute.

Executes the given command at some time in the future.

public int
getActiveCount()

Implements org.apache.tomcat.util.threads.ResizableExecutor.getActiveCount.

Returns the approximate number of threads that are actively executing tasks.

public long
public int
protected String
getDomainInternal()

Implements abstract org.apache.catalina.util.LifecycleMBeanBase.getDomainInternal.

Method implemented by sub-classes to identify the domain in which MBeans should be registered.

public int
public int
public int
public int
public int
public String
public String
protected String
getObjectNameKeyProperties()

Implements abstract org.apache.catalina.util.LifecycleMBeanBase.getObjectNameKeyProperties.

Allow sub-classes to specify the key properties component of the ObjectName that will be used to register this component.

public int
getPoolSize()

Implements org.apache.tomcat.util.threads.ResizableExecutor.getPoolSize.

Returns the current number of threads in the pool.

public int
public int
public long
public boolean
public boolean
resizePool(int corePoolSize, int maximumPoolSize)

Implements org.apache.tomcat.util.threads.ResizableExecutor.resizePool.

public boolean
public void
setDaemon(boolean daemon)

public void
setMaxIdleTime(int maxIdleTime)

public void
setMaxQueueSize(int size)

public void
setMaxThreads(int maxThreads)

public void
setMinSpareThreads(int minSpareThreads)

public void
public void
setNamePrefix(String namePrefix)

public void
setThreadPriority(int threadPriority)

public void
setThreadRenewalDelay(long threadRenewalDelay)

protected void
startInternal()

Implements abstract org.apache.catalina.util.LifecycleBase.startInternal.

Start the component and implement the requirements of org.apache.catalina.util.LifecycleBase#startInternal().

protected void
stopInternal()

Implements abstract org.apache.catalina.util.LifecycleBase.stopInternal.

Stop the component and implement the requirements of org.apache.catalina.util.LifecycleBase#stopInternal().

Inherited from org.apache.catalina.util.LifecycleMBeanBase:
destroyInternalgetDomaingetObjectNameinitInternalpostDeregisterpostRegisterpreDeregisterpreRegisterregistersetDomainunregisterunregister

Field Detail

daemonback to summary
protected boolean daemon

Run threads in daemon or non-daemon state

executorback to summary
protected ThreadPoolExecutor executor

The executor we use for this component

maxIdleTimeback to summary
protected int maxIdleTime

idle time in milliseconds

maxQueueSizeback to summary
protected int maxQueueSize

The maximum number of elements that can queue up before we reject them

maxThreadsback to summary
protected int maxThreads

max number of threads

minSpareThreadsback to summary
protected int minSpareThreads

min number of threads

nameback to summary
protected String name

the name of this thread pool

namePrefixback to summary
protected String namePrefix

Default name prefix for the thread name

smback to summary
protected static final StringManager sm

Hides org.apache.catalina.util.LifecycleMBeanBase.sm.

taskqueueback to summary
private TaskQueue taskqueue
threadPriorityback to summary
protected int threadPriority

Default thread priority

threadRenewalDelayback to summary
protected 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.

Constructor Detail

StandardThreadExecutorback to summary
public StandardThreadExecutor()

Method Detail

contextStoppingback to summary
public void contextStopping()
executeback to summary
public void execute(Runnable command)

Implements java.util.concurrent.Executor.execute.

Doc from java.util.concurrent.Executor.execute.

Executes 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 the Executor implementation.

Parameters
command:Runnable

the runnable task

Annotations
@Override
getActiveCountback to summary
public int getActiveCount()

Implements org.apache.tomcat.util.threads.ResizableExecutor.getActiveCount.

Doc from org.apache.tomcat.util.threads.ResizableExecutor.getActiveCount.

Returns the approximate number of threads that are actively executing tasks.

Returns:int

the number of threads

Annotations
@Override
getCompletedTaskCountback to summary
public long getCompletedTaskCount()
getCorePoolSizeback to summary
public int getCorePoolSize()
getDomainInternalback to summary
protected String getDomainInternal()

Implements abstract org.apache.catalina.util.LifecycleMBeanBase.getDomainInternal.

Doc from org.apache.catalina.util.LifecycleMBeanBase.getDomainInternal.

Method implemented by sub-classes to identify the domain in which MBeans should be registered.

Returns:String

The name of the domain to use to register MBeans.

Annotations
@Override
getLargestPoolSizeback to summary
public int getLargestPoolSize()
getMaxIdleTimeback to summary
public int getMaxIdleTime()
getMaxQueueSizeback to summary
public int getMaxQueueSize()
getMaxThreadsback to summary
public int getMaxThreads()

Implements org.apache.tomcat.util.threads.ResizableExecutor.getMaxThreads.

Annotations
@Override
getMinSpareThreadsback to summary
public int getMinSpareThreads()
getNameback to summary
public String getName()

Implements org.apache.catalina.Executor.getName.

Annotations
@Override
getNamePrefixback to summary
public String getNamePrefix()
getObjectNameKeyPropertiesback to summary
protected String getObjectNameKeyProperties()

Implements abstract org.apache.catalina.util.LifecycleMBeanBase.getObjectNameKeyProperties.

Doc from org.apache.catalina.util.LifecycleMBeanBase.getObjectNameKeyProperties.

Allow sub-classes to specify the key properties component of the ObjectName that will be used to register this component.

Returns:String

The string representation of the key properties component of the desired ObjectName

Annotations
@Override
getPoolSizeback to summary
public int getPoolSize()

Implements org.apache.tomcat.util.threads.ResizableExecutor.getPoolSize.

Doc from org.apache.tomcat.util.threads.ResizableExecutor.getPoolSize.

Returns the current number of threads in the pool.

Returns:int

the number of threads

Annotations
@Override
getQueueSizeback to summary
public int getQueueSize()
getThreadPriorityback to summary
public int getThreadPriority()
getThreadRenewalDelayback to summary
public long getThreadRenewalDelay()
isDaemonback to summary
public boolean isDaemon()
resizePoolback to summary
public boolean resizePool(int corePoolSize, int maximumPoolSize)

Implements org.apache.tomcat.util.threads.ResizableExecutor.resizePool.

Annotations
@Override
resizeQueueback to summary
public boolean resizeQueue(int capacity)

Implements org.apache.tomcat.util.threads.ResizableExecutor.resizeQueue.

Annotations
@Override
setDaemonback to summary
public void setDaemon(boolean daemon)
setMaxIdleTimeback to summary
public void setMaxIdleTime(int maxIdleTime)
setMaxQueueSizeback to summary
public void setMaxQueueSize(int size)
setMaxThreadsback to summary
public void setMaxThreads(int maxThreads)
setMinSpareThreadsback to summary
public void setMinSpareThreads(int minSpareThreads)
setNameback to summary
public void setName(String name)
setNamePrefixback to summary
public void setNamePrefix(String namePrefix)
setThreadPriorityback to summary
public void setThreadPriority(int threadPriority)
setThreadRenewalDelayback to summary
public void setThreadRenewalDelay(long threadRenewalDelay)
startInternalback to summary
protected void startInternal() throws LifecycleException

Implements abstract org.apache.catalina.util.LifecycleBase.startInternal.

Start the component and implement the requirements of org.apache.catalina.util.LifecycleBase#startInternal().

Annotations
@Override
Exceptions
LifecycleException:
if this component detects a fatal error that prevents this component from being used
stopInternalback to summary
protected void stopInternal() throws LifecycleException

Implements abstract org.apache.catalina.util.LifecycleBase.stopInternal.

Stop the component and implement the requirements of org.apache.catalina.util.LifecycleBase#stopInternal().

Annotations
@Override
Exceptions
LifecycleException:
if this component detects a fatal error that needs to be reported