You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by va...@apache.org on 2008/01/22 08:52:13 UTC

svn commit: r614136 - in /geronimo/server: branches/2.0/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/Deployer.java trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/Deployer.java

Author: vamsic007
Date: Mon Jan 21 23:52:11 2008
New Revision: 614136

URL: http://svn.apache.org/viewvc?rev=614136&view=rev
Log:
GERONIMO-3764 DeployerReaper fails to cleanup the temp directories left behind by deployer
 o Cleanup even when creation of temp file for deployment fails

Modified:
    geronimo/server/branches/2.0/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/Deployer.java
    geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/Deployer.java

Modified: geronimo/server/branches/2.0/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/Deployer.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.0/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/Deployer.java?rev=614136&r1=614135&r2=614136&view=diff
==============================================================================
--- geronimo/server/branches/2.0/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/Deployer.java (original)
+++ geronimo/server/branches/2.0/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/Deployer.java Mon Jan 21 23:52:11 2008
@@ -111,6 +111,7 @@
             // to address this we use a gross hack and copy the file to a temporary directory
             // the lock on the file will prevent that being deleted properly until the URLJarFile has
             // been GC'ed.
+            boolean cleanup = true;
             try {
                 tmpDir = File.createTempFile("geronimo-deployer", ".tmpdir");
                 tmpDir.delete();
@@ -118,8 +119,15 @@
                 File tmpFile = new File(tmpDir, moduleFile.getName());
                 DeploymentUtil.copyFile(moduleFile, tmpFile);
                 moduleFile = tmpFile;
+                cleanup = false;
             } catch (IOException e) {
                 throw new DeploymentException(e);
+            } finally {
+                // If an Exception is thrown in the try block above, we will need to cleanup here. 
+                if(cleanup && tmpDir != null && !DeploymentUtil.recursiveDelete(tmpDir)) {
+                    log.debug("Queued deployment directory to be reaped "+tmpDir);
+                    pendingDeletionIndex.setProperty(tmpDir.getAbsolutePath(), "delete");
+                }
             }
         }
 

Modified: geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/Deployer.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/Deployer.java?rev=614136&r1=614135&r2=614136&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/Deployer.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/Deployer.java Mon Jan 21 23:52:11 2008
@@ -110,6 +110,7 @@
             // to address this we use a gross hack and copy the file to a temporary directory
             // the lock on the file will prevent that being deleted properly until the URLJarFile has
             // been GC'ed.
+            boolean cleanup = true;
             try {
                 tmpDir = File.createTempFile("geronimo-deployer", ".tmpdir");
                 tmpDir.delete();
@@ -117,8 +118,14 @@
                 File tmpFile = new File(tmpDir, moduleFile.getName());
                 DeploymentUtil.copyFile(moduleFile, tmpFile);
                 moduleFile = tmpFile;
+                cleanup = false;
             } catch (IOException e) {
                 throw new DeploymentException(e);
+            } finally {
+                // If an Exception is thrown in the try block above, we will need to cleanup here. 
+                if(cleanup && tmpDir != null && !DeploymentUtil.recursiveDelete(tmpDir)) {
+                    reaper.delete(tmpDir.getAbsolutePath(), "delete");
+                }
             }
         }