public class MonitoredThreadPoolExecutor
extends java.util.concurrent.ThreadPoolExecutor
java.util.concurrent.ThreadPoolExecutor.AbortPolicy, java.util.concurrent.ThreadPoolExecutor.CallerRunsPolicy, java.util.concurrent.ThreadPoolExecutor.DiscardOldestPolicy, java.util.concurrent.ThreadPoolExecutor.DiscardPolicy
Modifier and Type | Field and Description |
---|---|
protected static boolean |
AGGRESSIVE
If true, be more aggressive when creating threads.
|
protected static int |
BASE_TCNT
Starting number of threads.
|
protected static boolean |
DEBUG
Print debug messages
|
protected java.util.concurrent.atomic.AtomicInteger |
idle
Number of idle threads in the pool.
|
protected static long |
LOSS_THRESHOLD
Threshold after which a _blocking_ thread is considered stolen.
|
protected static long |
LOSS_THRESHOLD_BUSY
Threshold after which a _non-blocking_ thread is considered stolen.
|
protected static long |
MONIT_CYCLE
Min.
|
protected static int |
MONIT_THRESHOLD
Threshold for activating monitoring.
|
protected boolean |
monitoring
Flag for monitoring thread activity.
|
protected java.util.concurrent.Semaphore |
monitoringlock
The lock for the monitoring thread.
|
protected java.lang.Thread |
monitthread
The monitoring thread.
|
protected MonitoredThread[] |
threads
The threads in the pool.
|
Constructor and Description |
---|
MonitoredThreadPoolExecutor() |
Modifier and Type | Method and Description |
---|---|
protected void |
borrow(MonitoredThread thread)
Borrows the thread.
|
protected void |
borrowNoUnpark(MonitoredThread thread)
Borrows the thread without unparking.
|
protected static MonitoredThread |
currentThread()
Gets the current MonitoredThread, for convenience.
|
void |
execute(java.lang.Runnable command) |
protected static void |
releaseLock(java.util.concurrent.Semaphore lock)
Releases the semaphore, includes null check.
|
afterExecute, allowCoreThreadTimeOut, allowsCoreThreadTimeOut, awaitTermination, beforeExecute, finalize, getActiveCount, getCompletedTaskCount, getCorePoolSize, getKeepAliveTime, getLargestPoolSize, getMaximumPoolSize, getPoolSize, getQueue, getRejectedExecutionHandler, getTaskCount, getThreadFactory, isShutdown, isTerminated, isTerminating, prestartAllCoreThreads, prestartCoreThread, purge, remove, setCorePoolSize, setKeepAliveTime, setMaximumPoolSize, setRejectedExecutionHandler, setThreadFactory, shutdown, shutdownNow, terminated, toString
protected static final boolean DEBUG
protected static final boolean AGGRESSIVE
protected static final int MONIT_THRESHOLD
protected static final int BASE_TCNT
protected static final long MONIT_CYCLE
protected static final long LOSS_THRESHOLD
protected static final long LOSS_THRESHOLD_BUSY
protected java.util.concurrent.atomic.AtomicInteger idle
protected volatile MonitoredThread[] threads
protected volatile java.util.concurrent.Semaphore monitoringlock
protected java.lang.Thread monitthread
protected boolean monitoring
public void execute(java.lang.Runnable command)
execute
in interface java.util.concurrent.Executor
execute
in class java.util.concurrent.ThreadPoolExecutor
protected void borrow(MonitoredThread thread)
thread
- Thre thread being borrowed.protected void borrowNoUnpark(MonitoredThread thread)
thread
- Thre thread being borrowed.protected static final void releaseLock(java.util.concurrent.Semaphore lock)
lock
- The lock.protected static final MonitoredThread currentThread()