src/share/classes/sun/awt/AppContext.java

Print this page




 325 
 326         if (appContext == mainAppContext)  {
 327             // Before we return the main "system" AppContext, check to
 328             // see if there's an AWTSecurityManager installed.  If so,
 329             // allow it to choose the AppContext to return.
 330             SecurityManager securityManager = System.getSecurityManager();
 331             if ((securityManager != null) &&
 332                 (securityManager instanceof AWTSecurityManager))
 333             {
 334                 AWTSecurityManager awtSecMgr = (AWTSecurityManager)securityManager;
 335                 AppContext secAppContext = awtSecMgr.getAppContext();
 336                 if (secAppContext != null)  {
 337                     appContext = secAppContext; // Return what we're told
 338                 }
 339             }
 340         }
 341 
 342         return appContext;
 343     }
 344 










 345     private long DISPOSAL_TIMEOUT = 5000;  // Default to 5-second timeout
 346                                            // for disposal of all Frames
 347                                            // (we wait for this time twice,
 348                                            // once for dispose(), and once
 349                                            // to clear the EventQueue).
 350 
 351     private long THREAD_INTERRUPT_TIMEOUT = 1000;
 352                             // Default to 1-second timeout for all
 353                             // interrupted Threads to exit, and another
 354                             // 1 second for all stopped Threads to die.
 355 
 356     /**
 357      * Disposes of this AppContext, all of its top-level Frames, and
 358      * all Threads and ThreadGroups contained within it.
 359      *
 360      * This method must be called from a Thread which is not contained
 361      * within this AppContext.
 362      *
 363      * @exception  IllegalThreadStateException  if the current thread is
 364      *                                    contained within this AppContext




 325 
 326         if (appContext == mainAppContext)  {
 327             // Before we return the main "system" AppContext, check to
 328             // see if there's an AWTSecurityManager installed.  If so,
 329             // allow it to choose the AppContext to return.
 330             SecurityManager securityManager = System.getSecurityManager();
 331             if ((securityManager != null) &&
 332                 (securityManager instanceof AWTSecurityManager))
 333             {
 334                 AWTSecurityManager awtSecMgr = (AWTSecurityManager)securityManager;
 335                 AppContext secAppContext = awtSecMgr.getAppContext();
 336                 if (secAppContext != null)  {
 337                     appContext = secAppContext; // Return what we're told
 338                 }
 339             }
 340         }
 341 
 342         return appContext;
 343     }
 344 
 345     /**
 346      * Returns the main ("system") AppContext.
 347      *
 348      * @return  the main AppContext
 349      * @since   8
 350      */
 351     final static AppContext getMainAppContext() {
 352         return mainAppContext;
 353     }
 354 
 355     private long DISPOSAL_TIMEOUT = 5000;  // Default to 5-second timeout
 356                                            // for disposal of all Frames
 357                                            // (we wait for this time twice,
 358                                            // once for dispose(), and once
 359                                            // to clear the EventQueue).
 360 
 361     private long THREAD_INTERRUPT_TIMEOUT = 1000;
 362                             // Default to 1-second timeout for all
 363                             // interrupted Threads to exit, and another
 364                             // 1 second for all stopped Threads to die.
 365 
 366     /**
 367      * Disposes of this AppContext, all of its top-level Frames, and
 368      * all Threads and ThreadGroups contained within it.
 369      *
 370      * This method must be called from a Thread which is not contained
 371      * within this AppContext.
 372      *
 373      * @exception  IllegalThreadStateException  if the current thread is
 374      *                                    contained within this AppContext