FileDocCategorySizeDatePackage
StopBoolean.javaAPI DocExample3018Sun Feb 08 21:34:08 GMT 2004None

StopBoolean

public class StopBoolean extends Thread
Show stopping a Thread using a flag.

Fields Summary
protected volatile boolean
done
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] args)

		StopBoolean t1 = new StopBoolean();
		t1.start();
		Thread.sleep(1000*5);
		t1.shutDown();
	
public voidrun()


	   
		while (!done) {
			System.out.println("StopBoolean running");
			try {
				sleep(720);
			} catch (InterruptedException ex) {
				// nothing to do 
			}
		}
		System.out.println("StopBoolean finished.");
	
public voidshutDown()

		done = true;