java.lang.Object
java.lang.Thread
org.apache.tomcat.util.threads.ThreadWithAttributes
- All Implemented Interfaces:
- java.lang.Runnable
- public class ThreadWithAttributes
- extends java.lang.Thread
Special thread that allows storing of attributes and notes.
A guard is used to prevent untrusted code from accessing the
attributes.
This avoids hash lookups and provide something very similar
with ThreadLocal ( but compatible with JDK1.1 and faster on
JDK < 1.4 ).
The main use is to store 'state' for monitoring ( like "processing
request 'GET /' ").
| Nested classes inherited from class java.lang.Thread |
java.lang.Thread.UncaughtExceptionHandler |
| Methods inherited from class java.lang.Thread |
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, 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 |
control
private java.lang.Object control
MAX_NOTES
public static int MAX_NOTES
notes
private java.lang.Object[] notes
attributes
private java.util.Hashtable attributes
currentStage
private java.lang.String currentStage
param
private java.lang.Object param
thData
private java.lang.Object[] thData
ThreadWithAttributes
public ThreadWithAttributes(java.lang.Object control,
java.lang.Runnable r)
getThreadData
public final java.lang.Object[] getThreadData(java.lang.Object control)
setThreadData
public final void setThreadData(java.lang.Object control,
java.lang.Object[] thData)
setNote
public final void setNote(java.lang.Object control,
int id,
java.lang.Object value)
- Notes - for attributes that need fast access ( array )
The application is responsible for id management
getCurrentStage
public final java.lang.String getCurrentStage(java.lang.Object control)
- Information about the curent performed operation
getParam
public final java.lang.Object getParam(java.lang.Object control)
- Information about the current request ( or the main object
we are processing )
setCurrentStage
public final void setCurrentStage(java.lang.Object control,
java.lang.String currentStage)
setParam
public final void setParam(java.lang.Object control,
java.lang.Object param)
getNote
public final java.lang.Object getNote(java.lang.Object control,
int id)
getAttributes
public final java.util.Hashtable getAttributes(java.lang.Object control)
- Generic attributes. You'll need a hashtable lookup -
you can use notes for array access.