Clover coverage report -
Coverage timestamp: Do Okt 21 2004 12:21:23 CEST
file stats: LOC: 62   Methods: 3
NCLOC: 45   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
WorkerThread.java 0% 0% 0% 0%
coverage
 1    /*
 2    * WorkerThread.java
 3    *
 4    * Created on 17. Oktober 2003, 20:05
 5    */
 6   
 7    package org.jconfig.server;
 8   
 9    import java.net.Socket;
 10    /**
 11    *
 12    * @author Administrator
 13    */
 14    public class WorkerThread extends Thread {
 15   
 16    private ProtocolHandler handler = null;
 17    private boolean active = false;
 18    private Socket socket = null;
 19    private ServerContext serverContext;
 20   
 21  0 public WorkerThread(ThreadGroup tg,String threadName) {
 22  0 super(tg,(Runnable)null,threadName);
 23    }
 24   
 25  0 public synchronized void execute(Socket socket,ProtocolHandler handler,ServerContext serverContext) {
 26  0 if ( this.handler != null ) {
 27  0 throw new IllegalStateException("Already running");
 28    }
 29  0 this.socket = socket;
 30  0 this.handler = handler;
 31  0 this.serverContext = serverContext;
 32  0 this.notifyAll();
 33  0 if ( !active ) {
 34  0 active = true;
 35  0 start();
 36    }
 37    }
 38   
 39  0 public void run() {
 40  0 while (active) {
 41  0 if (handler != null) {
 42  0 try {
 43  0 handler.execute(socket,serverContext);
 44    } catch (Exception e) {
 45  0 e.printStackTrace();
 46    }
 47    }
 48  0 this.handler = null;
 49  0 this.socket = null;
 50  0 synchronized (this) {
 51  0 while (active && handler == null) {
 52  0 try {
 53  0 wait();
 54    } catch (InterruptedException e) {
 55    }
 56    }
 57    }
 58   
 59    }
 60    }
 61   
 62    }