jdk/src/share/classes/sun/awt/AWTAutoShutdown.java
changeset 3972 8942e64cf57d
parent 3938 ef327bd847c0
parent 3969 6e77be3973ea
child 5506 202f599c92aa
equal deleted inserted replaced
3940:c6231c81f65c 3972:8942e64cf57d
   152         getInstance().setToolkitBusy(false);
   152         getInstance().setToolkitBusy(false);
   153     }
   153     }
   154 
   154 
   155     /**
   155     /**
   156      * Add a specified thread to the set of busy event dispatch threads.
   156      * Add a specified thread to the set of busy event dispatch threads.
   157      * If this set already contains the specified thread, the call leaves
   157      * If this set already contains the specified thread or the thread is null,
   158      * this set unchanged and returns silently.
   158      * the call leaves this set unchanged and returns silently.
   159      *
   159      *
   160      * @param thread thread to be added to this set, if not present.
   160      * @param thread thread to be added to this set, if not present.
   161      * @see     AWTAutoShutdown#notifyThreadFree
   161      * @see     AWTAutoShutdown#notifyThreadFree
   162      * @see     AWTAutoShutdown#isReadyToShutdown
   162      * @see     AWTAutoShutdown#isReadyToShutdown
   163      */
   163      */
   164     public void notifyThreadBusy(final Thread thread) {
   164     public void notifyThreadBusy(final Thread thread) {
       
   165         if (thread == null) {
       
   166             return;
       
   167         }
   165         synchronized (activationLock) {
   168         synchronized (activationLock) {
   166             synchronized (mainLock) {
   169             synchronized (mainLock) {
   167                 if (blockerThread == null) {
   170                 if (blockerThread == null) {
   168                     activateBlockerThread();
   171                     activateBlockerThread();
   169                 } else if (isReadyToShutdown()) {
   172                 } else if (isReadyToShutdown()) {
   175         }
   178         }
   176     }
   179     }
   177 
   180 
   178     /**
   181     /**
   179      * Remove a specified thread from the set of busy event dispatch threads.
   182      * Remove a specified thread from the set of busy event dispatch threads.
   180      * If this set doesn't contain the specified thread, the call leaves
   183      * If this set doesn't contain the specified thread or the thread is null,
   181      * this set unchanged and returns silently.
   184      * the call leaves this set unchanged and returns silently.
   182      *
   185      *
   183      * @param thread thread to be removed from this set, if present.
   186      * @param thread thread to be removed from this set, if present.
   184      * @see     AWTAutoShutdown#notifyThreadBusy
   187      * @see     AWTAutoShutdown#notifyThreadBusy
   185      * @see     AWTAutoShutdown#isReadyToShutdown
   188      * @see     AWTAutoShutdown#isReadyToShutdown
   186      */
   189      */
   187     public void notifyThreadFree(final Thread thread) {
   190     public void notifyThreadFree(final Thread thread) {
       
   191         if (thread == null) {
       
   192             return;
       
   193         }
   188         synchronized (activationLock) {
   194         synchronized (activationLock) {
   189             synchronized (mainLock) {
   195             synchronized (mainLock) {
   190                 busyThreadSet.remove(thread);
   196                 busyThreadSet.remove(thread);
   191                 if (isReadyToShutdown()) {
   197                 if (isReadyToShutdown()) {
   192                     mainLock.notifyAll();
   198                     mainLock.notifyAll();