src/java.desktop/windows/classes/sun/awt/windows/WToolkit.java

Print this page




 286     }
 287 
 288     private void registerShutdownHook() {
 289         AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
 290             Thread shutdown;
 291             if (System.getSecurityManager() == null) {
 292                 shutdown = new Thread(ThreadGroupUtils.getRootThreadGroup(), this::shutdown);
 293             } else {
 294                 shutdown = new InnocuousThread(this::shutdown);
 295             }
 296             shutdown.setContextClassLoader(null);
 297             Runtime.getRuntime().addShutdownHook(shutdown);
 298             return null;
 299          });
 300      }
 301 
 302     @Override
 303     public void run() {
 304         AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
 305             Thread.currentThread().setContextClassLoader(null);

 306             return null;
 307         });
 308         Thread.currentThread().setPriority(Thread.NORM_PRIORITY + 1);
 309         boolean startPump = init();
 310 
 311         if (startPump) {
 312             registerShutdownHook();
 313         }
 314 
 315         synchronized(this) {
 316             inited = true;
 317             notifyAll();
 318         }
 319 
 320         if (startPump) {
 321             eventLoop(); // will Dispose Toolkit when shutdown hook executes
 322         }
 323     }
 324 
 325     /*
 326      * eventLoop() begins the native message pump which retrieves and processes
 327      * native events.
 328      *




 286     }
 287 
 288     private void registerShutdownHook() {
 289         AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
 290             Thread shutdown;
 291             if (System.getSecurityManager() == null) {
 292                 shutdown = new Thread(ThreadGroupUtils.getRootThreadGroup(), this::shutdown);
 293             } else {
 294                 shutdown = new InnocuousThread(this::shutdown);
 295             }
 296             shutdown.setContextClassLoader(null);
 297             Runtime.getRuntime().addShutdownHook(shutdown);
 298             return null;
 299          });
 300      }
 301 
 302     @Override
 303     public void run() {
 304         AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
 305             Thread.currentThread().setContextClassLoader(null);
 306             Thread.currentThread().setPriority(Thread.NORM_PRIORITY + 1);
 307             return null;
 308         });
 309 
 310         boolean startPump = init();
 311 
 312         if (startPump) {
 313             registerShutdownHook();
 314         }
 315 
 316         synchronized(this) {
 317             inited = true;
 318             notifyAll();
 319         }
 320 
 321         if (startPump) {
 322             eventLoop(); // will Dispose Toolkit when shutdown hook executes
 323         }
 324     }
 325 
 326     /*
 327      * eventLoop() begins the native message pump which retrieves and processes
 328      * native events.
 329      *