changeset 11854:5b613a3c04be

8078216: JRE installation is stuck at Progress dialog Reviewed-by: prr, ddehaven
author serb
date Wed, 29 Apr 2015 19:43:55 +0300
parents 8e45c1f60155
children e16b52d3da99
files src/java.desktop/share/classes/sun/awt/AWTAutoShutdown.java
diffstat 1 files changed, 16 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.desktop/share/classes/sun/awt/AWTAutoShutdown.java	Wed Apr 29 20:06:35 2015 +0400
+++ b/src/java.desktop/share/classes/sun/awt/AWTAutoShutdown.java	Wed Apr 29 19:43:55 2015 +0300
@@ -26,7 +26,6 @@
 package sun.awt;
 
 import java.awt.AWTEvent;
-
 import java.security.AccessController;
 import java.security.PrivilegedAction;
 import java.util.HashSet;
@@ -34,9 +33,9 @@
 import java.util.Map;
 import java.util.Set;
 
+import sun.awt.util.ThreadGroupUtils;
 import sun.misc.InnocuousThread;
 import sun.util.logging.PlatformLogger;
-import sun.awt.util.ThreadGroupUtils;
 
 /**
  * This class is to let AWT shutdown automatically when a user is done
@@ -218,10 +217,7 @@
         synchronized (activationLock) {
             synchronized (mainLock) {
                 if (!isReadyToShutdown() && blockerThread == null) {
-                    AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
-                        activateBlockerThread();
-                        return null;
-                    });
+                    activateBlockerThread();
                 } else {
                     mainLock.notifyAll();
                     timeoutPassed = false;
@@ -337,21 +333,22 @@
     /**
      * Creates and starts a new blocker thread. Doesn't return until
      * the new blocker thread starts.
-     *
-     * Must be called with {@link sun.security.util.SecurityConstants#MODIFY_THREADGROUP_PERMISSION}
      */
     private void activateBlockerThread() {
-        Thread thread;
-        String name =  "AWT-Shutdown";
-        if (System.getSecurityManager() == null) {
-            thread = new Thread(ThreadGroupUtils.getRootThreadGroup(), this, name);
-        } else {
-            thread = new InnocuousThread(this, name);
-        }
-        thread.setContextClassLoader(null);
-        thread.setDaemon(false);
-        blockerThread = thread;
-        thread.start();
+        AccessController.doPrivileged((PrivilegedAction<Thread>) () -> {
+            Thread thread;
+            String name = "AWT-Shutdown";
+            if (System.getSecurityManager() == null) {
+                thread = new Thread(ThreadGroupUtils.getRootThreadGroup(), this,
+                                    name);
+            } else {
+                thread = new InnocuousThread(this, name);
+            }
+            thread.setContextClassLoader(null);
+            thread.setDaemon(false);
+            blockerThread = thread;
+            return thread;
+        }).start();
         try {
             /* Wait for the blocker thread to start. */
             mainLock.wait();