/***
 * A deprecated strategy for limiting the time of a thread.
 * not recommended, since it uses "stop()".
 * Test code by mitchfincher@yahoo.com
**/
public class TimeOut extends Thread {

long timeOut; 
Thread t;
Thread timerThread = new Thread();

/***
 * Target test thread, we will stop this in its tracks...
**/
static protected class Numbers extends Thread {
     int start; int finish;
     public Numbers(int start, int finish) {
	 this.start = start; this.finish=finish;
     }
    public void run() {
	    for(int i=start;i<=finish;i++) {
		System.out.print(i+",");
	    }
    }
}



public TimeOut (long timeOut, Thread t) {
    this.timeOut = timeOut;
    this.t = t;
}


public void run() {
    t.start();
    try {Thread.sleep(100);} catch(Exception e) {}
    System.out.println("t.stop();");
    t.stop();
    }


static public void main(String[] args) {
	System.out.println(": main ");
	Numbers numbers = new Numbers(0,80000);
	TimeOut timeOut = new TimeOut(0,numbers);
	timeOut.start();
    }


}
