geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r936616 - /geronimo/server/trunk/framework/modules/geronimo-main/src/main/java/org/apache/geronimo/main/Bootstrapper.java
Date Thu, 22 Apr 2010 05:23:35 GMT
Author: gawor
Date: Thu Apr 22 05:23:34 2010
New Revision: 936616

URL: http://svn.apache.org/viewvc?rev=936616&view=rev
Log:
register shutdown hook to remove the instance cache directory

Modified:
    geronimo/server/trunk/framework/modules/geronimo-main/src/main/java/org/apache/geronimo/main/Bootstrapper.java

Modified: geronimo/server/trunk/framework/modules/geronimo-main/src/main/java/org/apache/geronimo/main/Bootstrapper.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-main/src/main/java/org/apache/geronimo/main/Bootstrapper.java?rev=936616&r1=936615&r2=936616&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-main/src/main/java/org/apache/geronimo/main/Bootstrapper.java
(original)
+++ geronimo/server/trunk/framework/modules/geronimo-main/src/main/java/org/apache/geronimo/main/Bootstrapper.java
Thu Apr 22 05:23:34 2010
@@ -184,11 +184,6 @@ public class Bootstrapper {
             karafMain.destroy(await);
         } catch (Exception e) {
             e.printStackTrace();           
-        } finally {
-            if (uniqueStorage) {
-                String dir = System.getProperty(Constants.FRAMEWORK_STORAGE);
-                recursiveDelete(new File(dir));                
-            }
         }
     }
                 
@@ -272,12 +267,18 @@ public class Bootstrapper {
     }
     
     private String getStorageDirectory() throws IOException {
-        File storage;
+        final File storage;
         if (uniqueStorage) {
             File var = new File(getServer(), "var");
             File tmpFile = File.createTempFile("appclient-", "", var);
             storage = new File(var, tmpFile.getName() + "-cache");
             tmpFile.delete();
+            // register shutdown hook to remove the instance's cache directory
+            Runtime.getRuntime().addShutdownHook(new Thread() {
+                public void run() {
+                    recursiveDelete(storage);
+                }
+            });
         } else {
             storage = new File(getServer(), "var/cache");
         }



Mime
View raw message