Clover coverage report -
Coverage timestamp: Do Okt 21 2004 12:21:23 CEST
file stats: LOC: 52   Methods: 3
NCLOC: 32   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
ThreadPool.java 0% 0% 0% 0%
coverage
 1    /*
 2    * ThreadPool.java
 3    *
 4    * Created on 17. Oktober 2003, 16:22
 5    */
 6   
 7    package org.jconfig.server;
 8   
 9    import java.util.Vector;
 10    /**
 11    *
 12    * @author Administrator
 13    */
 14    public class ThreadPool {
 15   
 16    private Vector threadPool;
 17    private int maxSize = 50;
 18    private int counter = 0;
 19    private ThreadGroup tg;
 20    private String threadName;
 21   
 22  0 public ThreadPool() {
 23  0 threadPool = new Vector();
 24  0 tg = new ThreadGroup("SERVER THREAD POOL");
 25  0 threadName = "TP-ANON";
 26  0 for ( int i = 0; i < maxSize; i++) {
 27  0 try {
 28    //ProtocolHandler myHandler = (ProtocolHandler)clazz.newInstance();
 29    //threadPool.push(myHandler);
 30  0 WorkerThread wt = new WorkerThread(tg,threadName);
 31  0 threadPool.add(wt);
 32    }
 33    catch (Exception e) {
 34  0 e.printStackTrace();
 35    }
 36    }
 37    }
 38   
 39  0 public WorkerThread getWorker() {
 40    // TODO: check if there are threads available
 41  0 WorkerThread wt = (WorkerThread)threadPool.get(0);
 42  0 threadPool.remove(0);
 43  0 return wt;
 44    }
 45   
 46  0 public void releaseWorkerThread(WorkerThread wt) {
 47  0 counter --;
 48  0 threadPool.insertElementAt(wt, threadPool.size());
 49    }
 50   
 51   
 52    }