sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1734855 - /sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/system/Shutdown.java
Date Sun, 13 Mar 2016 20:34:57 GMT
Author: desruisseaux
Date: Sun Mar 13 20:34:57 2016
New Revision: 1734855

URL: http://svn.apache.org/viewvc?rev=1734855&view=rev
Log:
Temporarily remove the use of AccessController.doPrivileged(...) for shutdown hook (reverse
of SIS-320).
The reason is that we currently use a mechanism that allow anyone to register code to execute
as part of our shutdown.
This mechanism is in the internal packages of SIS, but there is currently no mechanism (other
than OSGi) to ensure that
only SIS uses this mechanism. We should be able to re-enable the use of AccessController.doPrivileged(...)
when we will
upgrate to jigsaw.

Modified:
    sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/system/Shutdown.java

Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/system/Shutdown.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/system/Shutdown.java?rev=1734855&r1=1734854&r2=1734855&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/system/Shutdown.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/system/Shutdown.java
[UTF-8] Sun Mar 13 20:34:57 2016
@@ -19,8 +19,6 @@ package org.apache.sis.internal.system;
 import java.util.List;
 import java.util.ArrayList;
 import java.util.concurrent.Callable;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
 import org.apache.sis.util.logging.Logging;
 
 // Branch-dependent imports
@@ -118,10 +116,7 @@ public final class Shutdown extends Thre
             resources.add(resource);
             if (hook == null && container == null) {
                 hook = new Shutdown();
-                AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
-                    Runtime.getRuntime().addShutdownHook(hook);
-                    return null;
-                });
+                Runtime.getRuntime().addShutdownHook(hook);
             }
         }
     }
@@ -132,10 +127,7 @@ public final class Shutdown extends Thre
     private static void removeShutdownHook() {
         assert Thread.holdsLock(resources);
         if (hook != null) {
-            AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
-                Runtime.getRuntime().removeShutdownHook(hook);
-                return null;
-            });
+            Runtime.getRuntime().removeShutdownHook(hook);
             hook = null;
         }
     }



Mime
View raw message