1 17 18 package org.apache.tomcat.util.threads; 19 20 import java.util.Hashtable ; 21 22 33 public class ThreadWithAttributes extends Thread { 34 35 private Object control; 36 public static int MAX_NOTES=16; 37 private Object notes[]=new Object [MAX_NOTES]; 38 private Hashtable attributes=new Hashtable (); 39 private String currentStage; 40 private Object param; 41 42 private Object thData[]; 43 44 public ThreadWithAttributes(Object control, Runnable r) { 45 super(r); 46 this.control=control; 47 } 48 49 public final Object [] getThreadData(Object control ) { 50 return thData; 51 } 52 53 public final void setThreadData(Object control, Object thData[] ) { 54 this.thData=thData; 55 } 56 57 60 public final void setNote( Object control, int id, Object value ) { 61 if( this.control != control ) return; 62 notes[id]=value; 63 } 64 65 67 public final String getCurrentStage(Object control) { 68 if( this.control != control ) return null; 69 return currentStage; 70 } 71 72 75 public final Object getParam(Object control) { 76 if( this.control != control ) return null; 77 return param; 78 } 79 80 public final void setCurrentStage(Object control, String currentStage) { 81 if( this.control != control ) return; 82 this.currentStage = currentStage; 83 } 84 85 public final void setParam( Object control, Object param ) { 86 if( this.control != control ) return; 87 this.param=param; 88 } 89 90 public final Object getNote(Object control, int id ) { 91 if( this.control != control ) return null; 92 return notes[id]; 93 } 94 95 98 public final Hashtable getAttributes(Object control) { 99 return attributes; 100 } 101 } 102 | Popular Tags |