[Jython-checkins] jython: ShutdownCloser now implements Runnable instead of extending Thread to

jim.baker jython-checkins at python.org
Fri May 23 01:26:17 CEST 2014


http://hg.python.org/jython/rev/55f7eaddc954
changeset:   7273:55f7eaddc954
user:        Timothée Lecomte <lecomte.timothee at gmail.com>
date:        Thu May 22 17:06:36 2014 -0600
summary:
  ShutdownCloser now implements Runnable instead of extending Thread to
avoid subclass audit issues when running under a SecurityManager,
which causes issues with respect to finalization/shutdown.

See http://code.google.com/p/guava-libraries/issues/detail?id=92#c86
for a related issue seen in the Google Collections library.

files:
  ACKNOWLEDGMENTS                        |   1 +
  src/org/python/core/PySystemState.java |  10 +++-------
  2 files changed, 4 insertions(+), 7 deletions(-)


diff --git a/ACKNOWLEDGMENTS b/ACKNOWLEDGMENTS
--- a/ACKNOWLEDGMENTS
+++ b/ACKNOWLEDGMENTS
@@ -108,6 +108,7 @@
     Indra Talip
     Michael Büsch
     Richard Eckart de Castilho
+    Timothée Lecomte
 
 Local Variables:
 mode: indented-text
diff --git a/src/org/python/core/PySystemState.java b/src/org/python/core/PySystemState.java
--- a/src/org/python/core/PySystemState.java
+++ b/src/org/python/core/PySystemState.java
@@ -1644,7 +1644,7 @@
         // Python scripts expect that files are closed upon an orderly cleanup of the VM.
         private Thread initShutdownCloser() {
             try {
-                Thread shutdownHook = new ShutdownCloser();
+                Thread shutdownHook = new Thread(new ShutdownCloser(), "Jython Shutdown Closer");
                 Runtime.getRuntime().addShutdownHook(shutdownHook);
                 return shutdownHook;
             } catch (SecurityException se) {
@@ -1653,13 +1653,9 @@
             }
         }
 
-        private class ShutdownCloser extends Thread {
+        private class ShutdownCloser implements Runnable {
 
-            private ShutdownCloser() {
-                super("Jython Shutdown Closer");
-            }
-
-            @Override
+        	@Override
             public synchronized void run() {
                 runClosers(resourceClosers);
                 resourceClosers.clear();

-- 
Repository URL: http://hg.python.org/jython


More information about the Jython-checkins mailing list