org.apache.tomcat.util.threads
Class ThreadWithAttributes
public
class
ThreadWithAttributes
extends 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 /' ").
Method Summary |
Hashtable | getAttributes(Object control) Generic attributes. |
String | getCurrentStage(Object control) Information about the curent performed operation |
Object | getNote(Object control, int id) |
Object | getParam(Object control) Information about the current request ( or the main object
we are processing ) |
Object[] | getThreadData(Object control) |
void | setCurrentStage(Object control, String currentStage) |
void | setNote(Object control, int id, Object value) Notes - for attributes that need fast access ( array )
The application is responsible for id management |
void | setParam(Object control, Object param) |
void | setThreadData(Object control, Object[] thData) |
public static int MAX_NOTES
public ThreadWithAttributes(Object control, Runnable r)
public final Hashtable getAttributes(Object control)
Generic attributes. You'll need a hashtable lookup -
you can use notes for array access.
public final String getCurrentStage(Object control)
Information about the curent performed operation
public final Object getNote(Object control, int id)
public final Object getParam(Object control)
Information about the current request ( or the main object
we are processing )
public final Object[] getThreadData(Object control)
public final void setCurrentStage(Object control, String currentStage)
public final void setNote(Object control, int id, Object value)
Notes - for attributes that need fast access ( array )
The application is responsible for id management
public final void setParam(Object control, Object param)
public final void setThreadData(Object control, Object[] thData)
Copyright © 2000-2011 Apache Software Foundation. All Rights Reserved.