/** The threads that are part of the pool.
* Key is Thread, value is the ControlRunnable
*/
- protected Hashtable threads=new Hashtable();
+ protected Hashtable<Thread, ControlRunnable> threads =
+ new Hashtable<Thread, ControlRunnable>();
- protected Vector listeners=new Vector();
+ protected Vector<ThreadPoolListener> listeners =
+ new Vector<ThreadPoolListener>();
/** Name of the threadpool
*/
// Set for future threads
this.threadPriority = threadPriority;
- Enumeration currentThreads = getThreads();
+ Enumeration<Thread> currentThreads = getThreads();
Thread t = null;
while(currentThreads.hasMoreElements()) {
- t = (Thread) currentThreads.nextElement();
+ t = currentThreads.nextElement();
t.setPriority(threadPriority);
}
}
public void addThread( Thread t, ControlRunnable cr ) {
threads.put( t, cr );
for( int i=0; i<listeners.size(); i++ ) {
- ThreadPoolListener tpl=(ThreadPoolListener)listeners.elementAt(i);
+ ThreadPoolListener tpl = listeners.elementAt(i);
tpl.threadStart(this, t);
}
}
public void removeThread( Thread t ) {
threads.remove(t);
for( int i=0; i<listeners.size(); i++ ) {
- ThreadPoolListener tpl=(ThreadPoolListener)listeners.elementAt(i);
+ ThreadPoolListener tpl = listeners.elementAt(i);
tpl.threadEnd(this, t);
}
}
listeners.addElement( tpl );
}
- public Enumeration getThreads(){
+ public Enumeration<Thread> getThreads(){
return threads.keys();
}
*/
public String threadStatusString() {
StringBuffer sb=new StringBuffer();
- Iterator it=threads.keySet().iterator();
+ Iterator<Thread> it=threads.keySet().iterator();
sb.append("<ul>");
while( it.hasNext()) {
sb.append("<li>");
*/
public String[] getThreadStatus() {
String status[]=new String[ threads.size()];
- Iterator it=threads.keySet().iterator();
+ Iterator<Thread> it=threads.keySet().iterator();
for( int i=0; ( i<status.length && it.hasNext()); i++ ) {
ThreadWithAttributes twa=(ThreadWithAttributes)
it.next();
*/
public String[] getThreadParam() {
String status[]=new String[ threads.size()];
- Iterator it=threads.keySet().iterator();
+ Iterator<Thread> it=threads.keySet().iterator();
for( int i=0; ( i<status.length && it.hasNext()); i++ ) {
ThreadWithAttributes twa=(ThreadWithAttributes)
it.next();