geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vamsic...@apache.org
Subject svn commit: r614127 - 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
Date Tue, 22 Jan 2008 07:13:53 GMT
Author: vamsic007
Date: Mon Jan 21 23:13:53 2008
New Revision: 614127

URL: http://svn.apache.org/viewvc?rev=614127&view=rev
Log:
GERONIMO-3764 DeployerReaper fails to cleanup the temp directories left behind by deployer
 o DeployerReaper in offline deployment does not get a chance to reap the temporary directories.
 Reap these directories in the next run.
 o If anyone has a better idea on how to handle this or sees something I am missing, please
suggest/comment.

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=614127&r1=614126&r2=614127&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:13:53 2008
@@ -18,6 +18,7 @@
 package org.apache.geronimo.deployment;
 
 import java.io.File;
+import java.io.FilenameFilter;
 import java.io.IOException;
 import java.net.URI;
 import java.util.ArrayList;
@@ -441,6 +442,11 @@
 
         public void run() {
             log.debug("ConfigStoreReaper started");
+
+            // DeployerReaper in offline deployment does not get a chance to reap the temporary
+            // directories. Reap any temporary directories left behind by previous runs here.
+            reapBacklog();
+
             while (!done) {
                 try {
                     Thread.sleep(reaperInterval);
@@ -448,6 +454,27 @@
                     continue;
                 }
                 reap();
+            }
+        }
+
+        /**
+         * Reap any temporary directories left behind by previous runs.
+         */
+        private void reapBacklog() {
+            try {
+                File tempFile = File.createTempFile("geronimo-deployer", ".tmpdir");
+                File tempDir = tempFile.getParentFile();
+                tempFile.delete();
+                String[] backlog = tempDir.list(new FilenameFilter(){
+                    public boolean accept(File dir, String name) {
+                        return name.startsWith("geronimo-deployer") && name.endsWith(".tmpdir")
&& new File(dir, name).isDirectory();
+                    }});
+                for(String dir: backlog) {
+                    File deleteDir = new File(tempDir, dir);
+                    DeploymentUtil.recursiveDelete(deleteDir);
+                    log.debug("Reaped deployment directory from previous runs " + deleteDir);
+                }
+            } catch (IOException ignored) {
             }
         }
 

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=614127&r1=614126&r2=614127&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:13:53 2008
@@ -18,6 +18,7 @@
 package org.apache.geronimo.deployment;
 
 import java.io.File;
+import java.io.FilenameFilter;
 import java.io.IOException;
 import java.net.URI;
 import java.net.URISyntaxException;
@@ -510,6 +511,11 @@
 
         public void run() {
             log.debug("ConfigStoreReaper started");
+
+            // DeployerReaper in offline deployment does not get a chance to reap the temporary
+            // directories. Reap any temporary directories left behind by previous runs here.
+            reapBacklog();
+
             while (!done) {
                 try {
                     Thread.sleep(reaperInterval);
@@ -517,6 +523,27 @@
                     continue;
                 }
                 reap();
+            }
+        }
+
+        /**
+         * Reap any temporary directories left behind by previous runs.
+         */
+        private void reapBacklog() {
+            try {
+                File tempFile = File.createTempFile("geronimo-deployer", ".tmpdir");
+                File tempDir = tempFile.getParentFile();
+                tempFile.delete();
+                String[] backlog = tempDir.list(new FilenameFilter(){
+                    public boolean accept(File dir, String name) {
+                        return name.startsWith("geronimo-deployer") && name.endsWith(".tmpdir")
&& new File(dir, name).isDirectory();
+                    }});
+                for(String dir: backlog) {
+                    File deleteDir = new File(tempDir, dir);
+                    DeploymentUtil.recursiveDelete(deleteDir);
+                    log.debug("Reaped deployment directory from previous runs " + deleteDir);
+                }
+            } catch (IOException ignored) {
             }
         }
 



Mime
View raw message