public class MonitoredThread
extends java.lang.Thread
Modifier and Type | Field and Description |
---|---|
protected boolean |
borrowed
Flag if the thread was borrowed.
|
protected long |
departure
Departure time of the thread from the pool.
|
protected int |
number
The thread number assigned to the thread.
|
protected MonitoredThreadPoolExecutor |
origin
Thread pool executor that created the thread.
|
Constructor and Description |
---|
MonitoredThread(java.lang.Runnable r,
MonitoredThreadPoolExecutor origin)
Creates the thread.
|
Modifier and Type | Method and Description |
---|---|
protected void |
borrow()
Notify the pool that the thread is borrowed and return
the return to the pool is expected to be delayed.
|
long |
getDeparture()
Gets the time the thread departed from the pool.
|
int |
getNumber()
Gets the thread number.
|
boolean |
isBlocked()
Returns if the thread is currently blocked.
|
boolean |
isBorrowed()
Returns if the thread is currently borrowed.
|
void |
setDeparture(long departure)
Sets the time the thread departed from the pool.
|
void |
setNumber(int num)
Sets the thread number.
|
static void |
tryBorrow()
Try to borrow the thread.
|
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, run, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
protected MonitoredThreadPoolExecutor origin
protected int number
protected volatile long departure
protected volatile boolean borrowed
public MonitoredThread(java.lang.Runnable r, MonitoredThreadPoolExecutor origin)
r
- The runnable to execute.origin
- The originating thread pool.public int getNumber()
public void setNumber(int num)
num
- The thread number.public long getDeparture()
public void setDeparture(long departure)
departure
- The time the thread departed from the pool.protected void borrow()
public boolean isBorrowed()
public boolean isBlocked()
public static final void tryBorrow()