Save This Page
Home » openjdk-7 » sun » awt » [javadoc | source]
sun.awt
public final class: AWTAutoShutdown [javadoc | source]
java.lang.Object
   sun.awt.AWTAutoShutdown

All Implemented Interfaces:
    Runnable

This class is to let AWT shutdown automatically when a user is done with AWT. It tracks AWT state using the following parameters:

AWT is considered to be in ready-to-shutdown state when peerMap is empty and toolkitThreadBusy is false and busyThreadSet is empty. The internal AWTAutoShutdown logic secures that the single non-daemon thread (blockerThread) is running when AWT is not in ready-to-shutdown state. This blocker thread is to prevent AWT from exiting since the toolkit thread is now daemon and all the event dispatch threads are started only when needed. Once it is detected that AWT is in ready-to-shutdown state this blocker thread waits for a certain timeout and if AWT state doesn't change during timeout this blocker thread terminates all the event dispatch threads and exits.
Method from sun.awt.AWTAutoShutdown Summary:
dumpPeers,   getInstance,   getPeer,   getShutdownEvent,   notifyPeerMapUpdated,   notifyThreadBusy,   notifyThreadFree,   notifyToolkitThreadBusy,   notifyToolkitThreadFree,   registerPeer,   run,   unregisterPeer
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from sun.awt.AWTAutoShutdown Detail:
 final  void dumpPeers(PlatformLogger aLog) 
 public static AWTAutoShutdown getInstance() 
    Returns reference to a single AWTAutoShutdown instance.
 final Object getPeer(Object target) 
 static AWTEvent getShutdownEvent() 
  void notifyPeerMapUpdated() 
    Notify that the peermap has been updated, that means a new peer has been created or some existing peer has been disposed.
 public  void notifyThreadBusy(Thread thread) 
    Add a specified thread to the set of busy event dispatch threads. If this set already contains the specified thread or the thread is null, the call leaves this set unchanged and returns silently.
 public  void notifyThreadFree(Thread thread) 
    Remove a specified thread from the set of busy event dispatch threads. If this set doesn't contain the specified thread or the thread is null, the call leaves this set unchanged and returns silently.
 public static  void notifyToolkitThreadBusy() 
    Notify that the toolkit thread is not waiting for a native event to appear in its queue.
 public static  void notifyToolkitThreadFree() 
    Notify that the toolkit thread is waiting for a native event to appear in its queue.
 final  void registerPeer(Object target,
    Object peer) 
 public  void run() 
    Implementation of the Runnable interface. Incapsulates the blocker thread functionality.
 final  void unregisterPeer(Object target,
    Object peer)