Top Description Methods
org.jboss.threads.management

public Interface StandardThreadPoolMXBean

Known Direct Implementers
org.jboss.threads.EnhancedQueueExecutor.MXBeanImpl, org.jboss.threads.ManagedThreadPoolExecutor.MXBeanImpl

An MXBean which contains the attributes and operations found on all standard thread pools.

Method Summary

Modifier and TypeMethod and Description
public int

Returns:

an estimate of the active count
getActiveCount
()

Get an estimate of the current number of active (busy) threads.

public long

Returns:

an estimate of the number of tasks completed by this thread pool
getCompletedTaskCount
()

Get an estimate of the number of tasks completed by this thread pool.

public int

Returns:

the core pool size
getCorePoolSize
()

Get the core pool size.

public float

Returns:

the growth resistance factor (0.0 ≤ n ≤ 1.0)
getGrowthResistance
()

Get the pool size growth resistance factor.

public long

Returns:

the thread keep-alive time, in seconds
getKeepAliveTimeSeconds
()

Get the thread keep-alive time, in seconds.

public int

Returns:

an estimate of the peak number of threads that the pool has ever held
getLargestPoolSize
()

Get an estimate of the peak number of threads that the pool has ever held.

public int

Returns:

an estimate of the peak size of the queue
getLargestQueueSize
()

Get an estimate of the peak size of the queue, if any.

public int

Returns:

the maximum pool size
getMaximumPoolSize
()

Get the maximum pool size.

public int

Returns:

the maximum queue size
getMaximumQueueSize
()

Get the maximum queue size for this thread pool.

public int

Returns:

an estimate of the current number of active threads in the pool
getPoolSize
()

Get an estimate of the current number of active threads in the pool.

public int

Returns:

an estimate of the current queue size
getQueueSize
()

Get an estimate of the current queue size, if any.

public long

Returns:

an estimate of the total number of tasks ever rejected by this thread pool
getRejectedTaskCount
()

Get an estimate of the total number of tasks ever rejected by this thread pool for any reason.

public default long

Returns:

an estimate of the number of spin misses
getSpinMissCount
()

Get the number of spin misses that have occurred.

public long

Returns:

an estimate of the total number of tasks ever submitted to this thread pool
getSubmittedTaskCount
()

Get an estimate of the total number of tasks ever submitted to this thread pool.

public boolean

Returns:

true if core threads are allowed to time out, false otherwise
isAllowCoreThreadTimeOut
()

Determine whether core threads are allowed to time out.

public boolean

Returns:

true if a separate core size is supported; false otherwise
isCorePoolSizeSupported
()

Determine whether this implementation supports a separate core pool size.

public boolean

Returns:

true if pre-starting core threads is supported, false otherwise
isCoreThreadPrestartSupported
()

Determine whether this thread pool allows manual pre-start of core threads.

public boolean

Returns:

true if the growth resistance factor is supported, false otherwise
isGrowthResistanceSupported
()

Determine whether the thread pool supports a growth resistance factor.

public boolean

Returns:

true if there is a bounded backing queue, false otherwise
isQueueBounded
()

Determine whether there is a bounded queue backing this thread pool.

public boolean

Returns:

true if the queue size is modifiable, false otherwise
isQueueSizeModifiable
()

Determine whether the maximum queue size is modifiable.

public boolean

Returns:

true if shutdown was requested, false otherwise
isShutdown
()

Determine whether shutdown was requested.

public boolean

Returns:

true if shutdown is complete, false otherwise
isTerminated
()

Determine whether shutdown is complete.

public boolean

Returns:

true if shutdown is in progress, false otherwise
isTerminating
()

Determine whether shutdown is in progress.

public int

Returns:

the number of started core threads (may be 0)
prestartAllCoreThreads
()

Attempt to start all core threads.

public boolean

Returns:

true if the thread was started, or false if the pool is filled to the core size, the thread could not be created, or prestart of core threads is not supported.
prestartCoreThread
()

Attempt to start a core thread without submitting work to it.

public void
setAllowCoreThreadTimeOut(boolean
true if core threads are allowed to time out, false otherwise
value
)

Establish whether core threads are allowed to time out.

public void
setCorePoolSize(int
the core pool size (must be greater than or equal to 0)
corePoolSize
)

Set the core pool size.

public void
setGrowthResistance(float
the growth resistance factor (0.0 ≤ n ≤ 1.0)
value
)

Set the pool size growth resistance factor, if supported.

public void
setKeepAliveTimeSeconds(long
the thread keep-alive time, in seconds (must be greater than or equal to 0)
seconds
)

Set the thread keep-alive time, in seconds.

public void
setMaximumPoolSize(final int
the maximum pool size (must be greater than or equal to 0)
maxPoolSize
)

Set the maximum pool size.

public void
setMaximumQueueSize(int
the maximum queue size for this thread pool
size
)

Set the maximum queue size for this thread pool.

Method Detail

getActiveCountback to summary
public int getActiveCount()

Get an estimate of the current number of active (busy) threads.

Returns:int

an estimate of the active count

getCompletedTaskCountback to summary
public long getCompletedTaskCount()

Get an estimate of the number of tasks completed by this thread pool. This number may be zero if the underlying thread pool does not support this metric.

Returns:long

an estimate of the number of tasks completed by this thread pool

getCorePoolSizeback to summary
public int getCorePoolSize()

Get the core pool size. This is the size below which new threads will always be created if no idle threads are available. If the thread pool does not support a separate core pool size, this size will match the maximum size.

Returns:int

the core pool size

getGrowthResistanceback to summary
public float getGrowthResistance()

Get the pool size growth resistance factor. If the thread pool does not support growth resistance, then 0.0 (no resistance) is returned.

Returns:float

the growth resistance factor (0.0 ≤ n ≤ 1.0)

getKeepAliveTimeSecondsback to summary
public long getKeepAliveTimeSeconds()

Get the thread keep-alive time, in seconds.

This method differs from the typical getKeepAliveTime(TimeUnit) due to the inability to send in a time units parameter on an MXBean attribute. As such, the unit is hard-coded to seconds.

Returns:long

the thread keep-alive time, in seconds

getLargestPoolSizeback to summary
public int getLargestPoolSize()

Get an estimate of the peak number of threads that the pool has ever held.

Returns:int

an estimate of the peak number of threads that the pool has ever held

getLargestQueueSizeback to summary
public int getLargestQueueSize()

Get an estimate of the peak size of the queue, if any. If no backing queue exists, or its size cannot be determined, this method will return 0.

Returns:int

an estimate of the peak size of the queue

getMaximumPoolSizeback to summary
public int getMaximumPoolSize()

Get the maximum pool size. This is the absolute upper limit to the size of the thread pool.

Returns:int

the maximum pool size

getMaximumQueueSizeback to summary
public int getMaximumQueueSize()

Get the maximum queue size for this thread pool. If there is no queue or it is not bounded, Integer#MAX_VALUE is returned.

Returns:int

the maximum queue size

getPoolSizeback to summary
public int getPoolSize()

Get an estimate of the current number of active threads in the pool.

Returns:int

an estimate of the current number of active threads in the pool

getQueueSizeback to summary
public int getQueueSize()

Get an estimate of the current queue size, if any. If no backing queue exists, or its size cannot be determined, this method will return 0.

Returns:int

an estimate of the current queue size

getRejectedTaskCountback to summary
public long getRejectedTaskCount()

Get an estimate of the total number of tasks ever rejected by this thread pool for any reason. This number may be zero if the underlying thread pool does not support this metric.

Returns:long

an estimate of the total number of tasks ever rejected by this thread pool

getSpinMissCountback to summary
public default long getSpinMissCount()

Get the number of spin misses that have occurred. Spin misses indicate that contention is not being properly handled by the thread pool.

Returns:long

an estimate of the number of spin misses

getSubmittedTaskCountback to summary
public long getSubmittedTaskCount()

Get an estimate of the total number of tasks ever submitted to this thread pool. This number may be zero if the underlying thread pool does not support this metric.

Returns:long

an estimate of the total number of tasks ever submitted to this thread pool

isAllowCoreThreadTimeOutback to summary
public boolean isAllowCoreThreadTimeOut()

Determine whether core threads are allowed to time out. A "core thread" is defined as any thread in the pool when the pool size is below the pool's core pool size. If the thread pool does not support a separate core pool size, this method should return false.

This method is named differently from the typical allowsCoreThreadTimeOut() in order to accommodate the requirements of MXBean attribute methods.

Returns:boolean

true if core threads are allowed to time out, false otherwise

isCorePoolSizeSupportedback to summary
public boolean isCorePoolSizeSupported()

Determine whether this implementation supports a separate core pool size.

Returns:boolean

true if a separate core size is supported; false otherwise

isCoreThreadPrestartSupportedback to summary
public boolean isCoreThreadPrestartSupported()

Determine whether this thread pool allows manual pre-start of core threads.

Returns:boolean

true if pre-starting core threads is supported, false otherwise

isGrowthResistanceSupportedback to summary
public boolean isGrowthResistanceSupported()

Determine whether the thread pool supports a growth resistance factor.

Returns:boolean

true if the growth resistance factor is supported, false otherwise

isQueueBoundedback to summary
public boolean isQueueBounded()

Determine whether there is a bounded queue backing this thread pool.

Returns:boolean

true if there is a bounded backing queue, false otherwise

isQueueSizeModifiableback to summary
public boolean isQueueSizeModifiable()

Determine whether the maximum queue size is modifiable.

Returns:boolean

true if the queue size is modifiable, false otherwise

isShutdownback to summary
public boolean isShutdown()

Determine whether shutdown was requested.

Returns:boolean

true if shutdown was requested, false otherwise

isTerminatedback to summary
public boolean isTerminated()

Determine whether shutdown is complete.

Returns:boolean

true if shutdown is complete, false otherwise

isTerminatingback to summary
public boolean isTerminating()

Determine whether shutdown is in progress.

Returns:boolean

true if shutdown is in progress, false otherwise

prestartAllCoreThreadsback to summary
public int prestartAllCoreThreads()

Attempt to start all core threads. This is usually equivalent to calling prestartCoreThread() in a loop until it returns false and counting the true results.

Returns:int

the number of started core threads (may be 0)

prestartCoreThreadback to summary
public boolean prestartCoreThread()

Attempt to start a core thread without submitting work to it.

Returns:boolean

true if the thread was started, or false if the pool is filled to the core size, the thread could not be created, or prestart of core threads is not supported.

setAllowCoreThreadTimeOutback to summary
public void setAllowCoreThreadTimeOut(boolean value)

Establish whether core threads are allowed to time out. A "core thread" is defined as any thread in the pool when the pool size is below the pool's core pool size. If the thread pool does not support a separate core pool size, the value is ignored.

This method is named differently from the typical allowCoreThreadTimeOut(boolean) in order to accommodate the requirements of MXBean attribute methods.

Parameters
value:boolean

true if core threads are allowed to time out, false otherwise

setCorePoolSizeback to summary
public void setCorePoolSize(int corePoolSize)

Set the core pool size. If the configured maximum pool size is less than the configured core size, the core size will be reduced to match the maximum size when the thread pool is constructed. If the thread pool does not support a separate core pool size, this setting will be ignored.

Parameters
corePoolSize:int

the core pool size (must be greater than or equal to 0)

setGrowthResistanceback to summary
public void setGrowthResistance(float value)

Set the pool size growth resistance factor, if supported.

Parameters
value:float

the growth resistance factor (0.0 ≤ n ≤ 1.0)

setKeepAliveTimeSecondsback to summary
public void setKeepAliveTimeSeconds(long seconds)

Set the thread keep-alive time, in seconds.

This method differs from the typical getKeepAliveTime(TimeUnit) due to the inability to send in a time units parameter on an MXBean attribute. As such, the unit is hard-coded to seconds.

Parameters
seconds:long

the thread keep-alive time, in seconds (must be greater than or equal to 0)

setMaximumPoolSizeback to summary
public void setMaximumPoolSize(final int maxPoolSize)

Set the maximum pool size. If the configured maximum pool size is less than the configured core size, the core size will be reduced to match the maximum size when the thread pool is constructed.

Parameters
maxPoolSize:int

the maximum pool size (must be greater than or equal to 0)

setMaximumQueueSizeback to summary
public void setMaximumQueueSize(int size)

Set the maximum queue size for this thread pool. If the new maximum queue size is smaller than the current queue size, there is no effect other than preventing tasks from being enqueued until the size decreases below the maximum again. If changing the maximum queue size is not supported, or there is no bounded backing queue, then the value is ignored.

Parameters
size:int

the maximum queue size for this thread pool