package thread;

public class ThreadTest
    implements Runnable {

  Thread t = new Thread(this);
  int threadTestNumber = 0;
  public static int n = 1000;

  ThreadTest() {
    t.start();
    threadTestNumber = n;
    n++;
  }

  public void sleep(long time) {
    try {
      Thread.sleep(time);
    } catch (InterruptedException e) {
      System.out.println(e);
    }
  }

  public void run() {
    while (true) {
      synchronized (System.out) {
        System.out.println(
            (
            threadTestNumber + ":" +
            new java.util.Date()).toString());
      }
      sleep((int) (Math.random() * 1000));
    }
  }

  public static void main(String args[]) {
    for (int i = 0; i < 9000; i++)
      new ThreadTest();
  }
}