Author: markt Date: Wed Apr 23 14:37:09 2008 New Revision: 651075 URL: http://svn.apache.org/viewvc?rev=651075&view=rev Log: Generics changes for o.a.t.util.threads No fucntional change
Modified: tomcat/trunk/java/org/apache/tomcat/util/threads/ThreadPool.java Modified: tomcat/trunk/java/org/apache/tomcat/util/threads/ThreadPool.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/threads/ThreadPool.java?rev=651075&r1=651074&r2=651075&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/threads/ThreadPool.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/threads/ThreadPool.java Wed Apr 23 14:37:09 2008 @@ -96,9 +96,11 @@ /** 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 */ @@ -180,10 +182,10 @@ // 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); } } @@ -270,7 +272,7 @@ 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); } } @@ -278,7 +280,7 @@ 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); } } @@ -287,7 +289,7 @@ listeners.addElement( tpl ); } - public Enumeration getThreads(){ + public Enumeration<Thread> getThreads(){ return threads.keys(); } @@ -784,7 +786,7 @@ */ 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>"); @@ -807,7 +809,7 @@ */ 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(); @@ -823,7 +825,7 @@ */ 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(); --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]