Additionally, this thread pool implementation supports scheduling of tasks. The scheduled tasks will execute on the main pool.
New instances of this thread pool are created by constructing and configuring a Builder instance, and calling
its build() method.
| Modifier and Type | Class and Description |
|---|---|
| pack-priv abstract class | EnhancedQueueExecutor.AbstractScheduledFuture<
the result type V>An implementation of |
| pack-priv static class | |
| public static class | EnhancedQueueExecutor.Builder
The builder class for an |
| pack-priv class | |
| pack-priv class | |
| pack-priv class | |
| pack-priv static class | |
| pack-priv static class | |
| pack-priv class | |
| pack-priv static class | |
| pack-priv abstract static class | EnhancedQueueExecutor.PoolThreadNodeBase
Padding between PoolThreadNode task and parked fields and QNode.next |
| pack-priv abstract static class | |
| pack-priv static class | |
| pack-priv abstract class | |
| pack-priv class | |
| pack-priv static interface | |
| pack-priv class | |
| pack-priv class | |
| pack-priv static class | |
| pack-priv static class | |
| pack-priv class | |
| pack-priv static class |
| Modifier and Type | Field and Description |
|---|---|
| private volatile AccessControlContext | acc
The access control context of the creating thread. |
| pack-priv static final Runnable | |
| pack-priv volatile int | activeCount
The current active number of threads. |
| private static final long | |
| pack-priv static final int | |
| pack-priv static final int | |
| pack-priv static final int | |
| pack-priv static final int | |
| pack-priv static final int | |
| pack-priv static final int | |
| pack-priv static final int | |
| private static final int | |
| private static final int | |
| private static final int | |
| private final LongAdder | |
| private final ContextHandler | contextHandler
The context handler for the user-defined context. |
| pack-priv static final Executor | |
| public static final boolean | DISABLE_HINT
A global hint which establishes whether it is recommended to disable uses of |
| pack-priv static final boolean | DISABLE_MBEAN
Set to enable or disable MBean registration. |
| pack-priv volatile Thread. | exceptionHandler
The handler for uncaught exceptions which occur during user tasks. |
| private static final int | |
| private static final int | |
| private static final int | |
| private static final int | |
| pack-priv static final Runnable | |
| pack-priv static final Runnable | |
| pack-priv volatile float | growthResistance
A resistance factor applied after the core pool is full; values applied here will cause that fraction of submissions to create new threads when no idle thread is available. |
| private final Object | handle
The MBean registration handle (if any). |
| pack-priv volatile Executor | handoffExecutor
The handler for tasks which cannot be accepted by the executor. |
| private final EnhancedQueueExecutor. | mxBean
The management bean instance. |
| pack-priv static final EnhancedQueueExecutor. | |
| pack-priv static final boolean | NO_QUEUE_LIMIT
Suppress queue limit and size tracking for performance. |
| private static final Thread[] | |
| pack-priv static final int | PARK_SPINS
The number of times a thread should spin/yield before actually parking. |
| pack-priv volatile int | peakQueueSize
The approximate peak queue size. |
| private static final long | |
| pack-priv volatile int | peakThreadCount
The peak number of threads ever created by this pool. |
| private static final long | |
| pack-priv volatile long | |
| private static final long | |
| pack-priv static final boolean | REGISTER_MBEAN
Set the default value for whether an mbean is to be auto-registered for the thread pool. |
| private final LongAdder | |
| private final Set | runningThreads
The approximate set of pooled threads. |
| pack-priv static final AtomicLong | |
| private final EnhancedQueueExecutor. | schedulerTask
The task for scheduled execution. |
| private final Thread | schedulerThread
The scheduler thread. |
| pack-priv static final AtomicInteger | |
| private final LongAdder | |
| private final LongAdder | |
| pack-priv static final EnhancedQueueExecutor. | |
| pack-priv static final Waiter | |
| pack-priv static final EnhancedQueueExecutor. | |
| pack-priv volatile Runnable | terminationTask
The termination task to execute when the thread pool exits. |
| pack-priv volatile Waiter | terminationWaiters
The linked list of threads waiting for termination of this thread pool. |
| private static final long | |
| private final ThreadFactory | threadFactory
The thread factory. |
| pack-priv volatile long | timeoutNanos
The thread keep-alive timeout value. |
| private static final long | |
| private static final long | |
| private static final long | |
| private static final long | |
| private static final long | |
| private static final long | |
| private static final long | |
| private static final long | |
| pack-priv static final boolean | UPDATE_ACTIVE_COUNT
Maintain an estimate of the number of threads which are currently doing work on behalf of the thread pool. |
| pack-priv static final boolean | UPDATE_STATISTICS
Update the summary statistics. |
| pack-priv static final Runnable | |
| pack-priv static final int | YIELD_FACTOR
The yield ratio expressed as the number of spins that should yield. |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public void | allowCoreThreadTimeOut(boolean
true if core threads are allowed to time out, false otherwiseEstablish whether core threads are allowed to time out. |
| public boolean | Returns: true if core threads are allowed to time out, false otherwiseDetermine whether core threads are allowed to time out. |
| public boolean | Returns: true if the thread pool terminated within the given timeout, false otherwisethe amount of time to wait (must be ≥ 0) timeout, final TimeUnit the unit of time to use for waiting (must not be unit)null)Implements java. |
| pack-priv boolean | |
| pack-priv boolean | |
| pack-priv boolean | |
| pack-priv boolean | |
| pack-priv void | |
| pack-priv static int | |
| pack-priv static int | |
| pack-priv static int | |
| pack-priv void | |
| pack-priv void | |
| pack-priv void | |
| pack-priv boolean | Returns: true if the thread was started, false otherwisethe task or runnablenullStart an allocated thread. |
| public void | execute(Runnable
the task to execute (must not be runnable)null)Implements java. |
| public int | Returns: the active count estimate or -1 whenjboss.threads.eqe.statistics.active-count is disabledGet an estimate of the number of threads which are currently doing work on behalf of the thread pool. |
| pack-priv Waiter | |
| public long | Returns: an estimate of the number of tasks completed by this thread pool or -1 whenjboss.threads.eqe.statistics is disabledGet an estimate of the number of tasks completed by this thread pool. |
| public int | |
| public Thread. | Returns: the exception handler to use for uncaught exceptions (notnull)Get the exception handler to use for uncaught exceptions. |
| public float | Returns: the configured growth resistance factorGet the thread pool growth resistance. |
| public Executor | Returns: the executor to delegate to in the event of task rejection (notnull)Get the executor to delegate to in the event of task rejection. |
| public long | Returns: the amount of time (will be greater than zero)the unit in which the result should be expressed (must not be keepAliveUnits)null)
Deprecated
Use
Get the thread keep-alive time.
getKeepAliveTime() instead.
|
| public Duration | Returns: the amount of time (will be greater than zero)Get the thread keep-alive time. |
| public int | Returns: an estimate of the peak number of threads that the pool has ever heldGet an estimate of the peak number of threads that the pool has ever held. |
| public int | |
| public int | |
| public int | |
| public int | Returns: an estimate of the current number of active threads in the poolGet an estimate of the current number of active threads in the pool. |
| public int | Returns: an estimate of the current queue size or -1 whenjboss.threads.eqe.unlimited-queue is enabledGet an estimate of the current queue size. |
| public long | Returns: an estimate of the total number of tasks ever rejected by this thread pool or -1 whenjboss.threads.eqe.statistics is disabledGet an estimate of the total number of tasks ever rejected by this thread pool for any reason. |
| public Thread[] | Returns: an array of running (unterminated) threads (notnull)Get an array containing an approximate snapshot of the currently running threads in this executor. |
| public long | Returns: an estimate of the total number of tasks ever submitted to this thread pool or -1 whenjboss.threads.eqe.statistics is disabledGet an estimate of the total number of tasks ever submitted to this thread pool. |
| public StandardThreadPoolMXBean | getThreadPoolMXBean()
Implements org. |
| pack-priv boolean | |
| pack-priv void | |
| pack-priv static boolean | |
| public boolean | Returns: true if shutdown was requested, false otherwiseImplements java. |
| pack-priv static boolean | |
| pack-priv static boolean | |
| pack-priv static boolean | |
| public boolean | Returns: true if shutdown has completed, false otherwiseImplements java. |
| public boolean | Returns: true if the thread pool is terminating, or false if the thread pool is not terminating or has completed terminationDetermine if this thread pool is in the process of terminating but has not yet completed. |
| pack-priv static int | |
| pack-priv static int | |
| pack-priv static Runnable | |
| public int | |
| public boolean | Returns: true if a core thread was started, or false if all core threads were already running or
if the thread failed to be created for some other reasonStart an idle core thread. |
| pack-priv void | |
| pack-priv void | |
| pack-priv void | |
| pack-priv void | |
| public ScheduledFuture | schedule(final Runnable
the task to execute command, final long the time from now to delay execution delay, final TimeUnit the time unit of the delay parameter unit)Implements java. |
| public <V> ScheduledFuture | schedule(final Callable<V>
the function to execute callable, final long the time from now to delay execution delay, final TimeUnit the time unit of the delay parameter unit)Implements java. |
| public ScheduledFuture | scheduleAtFixedRate(final Runnable
the task to execute command, final long the time to delay first execution initialDelay, final long the period between successive executions period, final TimeUnit the time unit of the initialDelay and period parameters unit)Implements java. initialDelay, then initialDelay + period, then
initialDelay + 2 * period, and so on.
|
| public ScheduledFuture | scheduleWithFixedDelay(final Runnable
the task to execute command, final long the time to delay first execution initialDelay, final long the delay between the termination of one
execution and the commencement of the next delay, final TimeUnit the time unit of the initialDelay and delay parameters unit)Implements java. |
| public void | setCorePoolSize(final int
the core pool size (must be greater than or equal to 0, and less than 2^20) corePoolSize)Set the core pool size. |
| public void | setExceptionHandler(final Thread.
the exception handler to use for uncaught exceptions (must not be exceptionHandlernull)Set the exception handler to use for uncaught exceptions. |
| public void | setGrowthResistance(final float
the thread pool growth resistance (must be in the range growthResistance)0.0f ≤ n ≤ 1.0f)Set the growth resistance factor. |
| public void | setHandoffExecutor(final Executor
the executor to delegate to in the event of task rejection (must not be handoffExecutor)null)Set the executor to delegate to in the event of task rejection. |
| public void | setKeepAliveTime(final long
the thread keep-alive time (must be > 0) keepAliveTime, final TimeUnit the unit in which the value is expressed (must not be keepAliveUnits)null)
Deprecated
Use
Set the thread keep-alive time.
setKeepAliveTime(Duration) instead.
|
| public void | setKeepAliveTime(final Duration
the thread keep-alive time (must not be keepAliveTime)null)Set the thread keep-alive time. |
| public void | setMaximumPoolSize(final int
the maximum pool size (must be greater than or equal to 0, and less than 2^20) maxPoolSize)Set the maximum pool size. |
| public void | setMaximumQueueSize(final int
the maximum queue size (must be ≥ 0) maxQueueSize)Set the maximum queue size. |
| public void | setTerminationTask(final Runnable
the termination task, or terminationTask)null to perform no termination taskSet the termination task, overwriting any previous setting. |
| public void | shutdown()
Implements java. |
| public void | shutdown(boolean
true to request that currently-running tasks be interrupted; false otherwiseInitiate shutdown of this thread pool. |
| public List | Returns: a list of pending tasks (notnull)Implements java. |
| private void | |
| pack-priv int | Returns: AT_YES if a thread is allocated; AT_NO if a thread was not allocated; AT_SHUTDOWN if the pool is being shut downthe growth resistance to apply growthResistance)Allocate a new thread. |
| pack-priv boolean | Returns: true if the thread was deallocated, or false to retry with a new oldStatthe oldStat)threadStatus to CASTry to roll back a thread allocation, possibly running the termination task if the pool would be terminated by last thread exit. |
| private int | |
| pack-priv static long | |
| pack-priv static long | |
| pack-priv static long | |
| pack-priv static long | |
| pack-priv static long | |
| pack-priv static long | |
| pack-priv static long | |
| pack-priv static long | |
| pack-priv static long | |
| pack-priv static int |