// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
import java.io.*;

public class Test {
   private final static int N = 10000;
   public static void main(String[] args) throws Exception {
      String[] t = new String[N];
      Queue q = new Queue();
      WorkerPool pool = new WorkerPool(100, q);
      for(int i = 0; i < N; i++) {
         q.enqueue(new TestJob(i, t));
      }
      while(!q.isDone()) {
         Thread.sleep(10);
      }
      pool.killAll();
      PrintWriter pw = new PrintWriter(new FileOutputStream("C:\\t.lis"));
      for(int i = 0; i < t.length; i++) {
         pw.println(t[i]);
      }
      pw.close();
   }
}
