SF.net SVN: jython:[7129] trunk/jython/src/org/python/core/PySystemState. java

[email protected] Fri, 01 Oct 2010 02:13:43 +0000
Newsgroups gmane.comp.lang.jython.cvs
Message-ID <[email protected]>
Revision: 7129
          http://jython.svn.sourceforge.net/jython/?rev=7129&view=rev
Author:   zyasoft
Date:     2010-10-01 02:13:43 +0000 (Fri, 01 Oct 2010)

Log Message:
-----------
Attempting to remove a shutdown hook when the JVM is already shutting
down should be quietly ignored.

Modified Paths:
--------------
    trunk/jython/src/org/python/core/PySystemState.java

Modified: trunk/jython/src/org/python/core/PySystemState.java
===================================================================
--- trunk/jython/src/org/python/core/PySystemState.java	2010-09-29 06:29:59 UTC (rev 7128)
+++ trunk/jython/src/org/python/core/PySystemState.java	2010-10-01 02:13:43 UTC (rev 7129)
@@ -1343,7 +1343,11 @@
 
             // close this thread so we can unload any associated classloaders in cycle with this instance
             if (shutdownHook != null) {
-                Runtime.getRuntime().removeShutdownHook(shutdownHook);
+                try {
+                    Runtime.getRuntime().removeShutdownHook(shutdownHook);
+                } catch (IllegalStateException e) {
+                    // JVM is already shutting down, so we cannot remove this shutdown hook anyway
+                }
             }
 
             for (Callable callable : resourceClosers) {


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev