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 /' ").
Field Summary
static intMAX_NOTES
Constructor Summary
ThreadWithAttributes(Object control, Runnable r)
Method Summary
HashtablegetAttributes(Object control)
Generic attributes.
StringgetCurrentStage(Object control)
Information about the curent performed operation
ObjectgetNote(Object control, int id)
ObjectgetParam(Object control)
Information about the current request ( or the main object we are processing )
Object[]getThreadData(Object control)
voidsetCurrentStage(Object control, String currentStage)
voidsetNote(Object control, int id, Object value)
Notes - for attributes that need fast access ( array ) The application is responsible for id management
voidsetParam(Object control, Object param)
voidsetThreadData(Object control, Object[] thData)

Field Detail

MAX_NOTES

public static int MAX_NOTES

Constructor Detail

ThreadWithAttributes

public ThreadWithAttributes(Object control, Runnable r)

Method Detail

getAttributes

public final Hashtable getAttributes(Object control)
Generic attributes. You'll need a hashtable lookup - you can use notes for array access.

getCurrentStage

public final String getCurrentStage(Object control)
Information about the curent performed operation

getNote

public final Object getNote(Object control, int id)

getParam

public final Object getParam(Object control)
Information about the current request ( or the main object we are processing )

getThreadData

public final Object[] getThreadData(Object control)

setCurrentStage

public final void setCurrentStage(Object control, String currentStage)

setNote

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

setParam

public final void setParam(Object control, Object param)

setThreadData

public final void setThreadData(Object control, Object[] thData)
Copyright © 2000-2011 Apache Software Foundation. All Rights Reserved.