| |
|
| java.lang.Object sun.awt.AWTAutoShutdown
AWTAutoShutdown | final public class AWTAutoShutdown implements Runnable(Code) | | This class is to let AWT shutdown automatically when a user is done
with AWT. It tracks AWT state using the following parameters:
peerMap - the map between the existing peer objects
and their associated targets
toolkitThreadBusy - whether the toolkit thread
is waiting for a new native event to appear in its queue
or is dispatching an event
busyThreadSet - a set of all the event dispatch
threads that are busy at this moment, i.e. those that are not
waiting for a new event to appear in their event queue.
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.
|
getInstance | public static AWTAutoShutdown getInstance()(Code) | | Returns reference to a single AWTAutoShutdown instance.
|
notifyPeerMapUpdated | void notifyPeerMapUpdated()(Code) | | Notify that the peermap has been updated, that means a new peer
has been created or some existing peer has been disposed.
See Also: AWTAutoShutdown.isReadyToShutdown |
notifyThreadBusy | public void notifyThreadBusy(Thread thread)(Code) | | Add a specified thread to the set of busy event dispatch threads.
If this set already contains the specified thread, the call leaves
this set unchanged and returns silently.
Parameters: thread - thread to be added to this set, if not present. See Also: AWTAutoShutdown.notifyThreadFree See Also: AWTAutoShutdown.isReadyToShutdown |
notifyThreadFree | public void notifyThreadFree(Thread thread)(Code) | | Remove a specified thread from the set of busy event dispatch threads.
If this set doesn't contain the specified thread, the call leaves
this set unchanged and returns silently.
Parameters: thread - thread to be removed from this set, if present. See Also: AWTAutoShutdown.notifyThreadBusy See Also: AWTAutoShutdown.isReadyToShutdown |
|
|
|