FileDocCategorySizeDatePackage
ShutdownThread.javaAPI DocAndroid 1.5 API2500Wed May 06 22:41:54 BST 2009org.apache.harmony.awt.wtk

ShutdownThread

public final class ShutdownThread extends Thread
author
Michael Danilov, Pavel Dolgov
version
$Revision$

Fields Summary
private boolean
shouldStop
Constructors Summary
public ShutdownThread()

        setName("AWT-Shutdown"); //$NON-NLS-1$
        setDaemon(false);
    
Methods Summary
public voidrun()


    
       
        synchronized (this) {
            notifyAll(); // synchronize the startup

            while (true) {
                try {
                    wait();
                } catch (InterruptedException e) {
                }

                if (shouldStop) {
                    notifyAll(); // synchronize the shutdown
                    return;
                }
            }
        }
    
public voidshutdown()

        synchronized (this) {
            shouldStop = true;
            notifyAll();
            try {
                wait();
            } catch (InterruptedException e) {
                // awt.27=Shutdown thread was interrupted while stopping
                throw new RuntimeException(
                        Messages.getString("awt.27")); //$NON-NLS-1$
            }
        }
    
public voidstart()

        synchronized (this) {
            super.start();
            try {
                wait();
            } catch (InterruptedException e) {
                // awt.26=Shutdown thread was interrupted while starting
                throw new RuntimeException(
                        Messages.getString("awt.26")); //$NON-NLS-1$
            }
        }