geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vamsic...@apache.org
Subject svn commit: r617659 - in /geronimo/server: branches/2.0/configs/offline-deployer/src/plan/ branches/2.0/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/util/ trunk/framework/configs/offline-deployer/src/main/plan/ trunk/framewo...
Date Fri, 01 Feb 2008 21:29:32 GMT
Author: vamsic007
Date: Fri Feb  1 13:29:25 2008
New Revision: 617659

URL: http://svn.apache.org/viewvc?rev=617659&view=rev
Log:
GERONIMO-3764 DeployerReaper fails to cleanup the temp directories left behind by deployer
 o Offline deployer leaves temporary files behind since using URLs with "jar" protocol locks
the jar file and prevents deletion.  This is prevented by creating a temporary file when the
protocol is "jar".
 o This behaviour is controlled using a system property "org.apache.geronimo.deployment.util.DeploymentUtil.jarUrlRewrite"
which is false by default, meaning no change from existing behavior for online-deployer.
 o Offline deployer sets the system property to true.
 o See http://www.mail-archive.com/dev@geronimo.apache.org/msg55811.html

Modified:
    geronimo/server/branches/2.0/configs/offline-deployer/src/plan/plan.xml
    geronimo/server/branches/2.0/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/util/DeploymentUtil.java
    geronimo/server/trunk/framework/configs/offline-deployer/src/main/plan/plan.xml
    geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/util/DeploymentUtil.java

Modified: geronimo/server/branches/2.0/configs/offline-deployer/src/plan/plan.xml
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.0/configs/offline-deployer/src/plan/plan.xml?rev=617659&r1=617658&r2=617659&view=diff
==============================================================================
--- geronimo/server/branches/2.0/configs/offline-deployer/src/plan/plan.xml (original)
+++ geronimo/server/branches/2.0/configs/offline-deployer/src/plan/plan.xml Fri Feb  1 13:29:25
2008
@@ -28,4 +28,10 @@
         <attribute name="configFile">var/config/offline-deployer-config.xml</attribute>
     </gbean>
 
+    <!-- System Properties -->
+    <gbean name="OfflineDeployerProperties" class="org.apache.geronimo.system.properties.SystemProperties">
+        <attribute name="systemProperties">
+             org.apache.geronimo.deployment.util.DeploymentUtil.jarUrlRewrite=true
+        </attribute>
+    </gbean>
 </module>

Modified: geronimo/server/branches/2.0/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/util/DeploymentUtil.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.0/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/util/DeploymentUtil.java?rev=617659&r1=617658&r2=617659&view=diff
==============================================================================
--- geronimo/server/branches/2.0/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/util/DeploymentUtil.java
(original)
+++ geronimo/server/branches/2.0/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/util/DeploymentUtil.java
Fri Feb  1 13:29:25 2008
@@ -48,7 +48,9 @@
     }
 
     public static final File DUMMY_JAR_FILE;
+    private static final boolean jarUrlRewrite;
     static {
+        jarUrlRewrite = new Boolean(System.getProperty("org.apache.geronimo.deployment.util.DeploymentUtil.jarUrlRewrite",
"false"));
         try {
             DUMMY_JAR_FILE = DeploymentUtil.createTempFile();
             new JarOutputStream(new FileOutputStream(DeploymentUtil.DUMMY_JAR_FILE), new
Manifest()).close();
@@ -222,7 +224,25 @@
             return new File(baseDir, path).toURL();
         } else {
             String urlString = "jar:" + new File(jarFile.getName()).toURL() + "!/" + path;
-            return new URL(urlString);
+            if(jarUrlRewrite) {
+                // To prevent the lockout of archive, instead of returning a jar url, write
the content to a
+                // temp file and return the url of that file.
+                File tempFile = null;
+                try {
+                    tempFile = toTempFile(new URL(urlString));
+                } catch (IOException e) {
+                    // The JarEntry does not exist!
+                    // Return url of a file that does not exist.
+                    try {
+                        tempFile = createTempFile();
+                        tempFile.delete();
+                    } catch (IOException ignored) {
+                    }
+                 }
+                return tempFile.toURL();
+            } else {
+                return new URL(urlString);
+            }
         }
     }
 

Modified: geronimo/server/trunk/framework/configs/offline-deployer/src/main/plan/plan.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/configs/offline-deployer/src/main/plan/plan.xml?rev=617659&r1=617658&r2=617659&view=diff
==============================================================================
--- geronimo/server/trunk/framework/configs/offline-deployer/src/main/plan/plan.xml (original)
+++ geronimo/server/trunk/framework/configs/offline-deployer/src/main/plan/plan.xml Fri Feb
 1 13:29:25 2008
@@ -28,4 +28,10 @@
         <attribute name="configFile">var/config/offline-deployer-config.xml</attribute>
     </gbean>
 
+    <!-- System Properties -->
+    <gbean name="OfflineDeployerProperties" class="org.apache.geronimo.system.properties.SystemProperties">
+        <attribute name="systemProperties">
+             org.apache.geronimo.deployment.util.DeploymentUtil.jarUrlRewrite=true
+        </attribute>
+    </gbean>
 </module>

Modified: geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/util/DeploymentUtil.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/util/DeploymentUtil.java?rev=617659&r1=617658&r2=617659&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/util/DeploymentUtil.java
(original)
+++ geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/util/DeploymentUtil.java
Fri Feb  1 13:29:25 2008
@@ -48,7 +48,9 @@
     }
 
     public static final File DUMMY_JAR_FILE;
+    private static final boolean jarUrlRewrite;
     static {
+        jarUrlRewrite = new Boolean(System.getProperty("org.apache.geronimo.deployment.util.DeploymentUtil.jarUrlRewrite",
"false"));
         try {
             DUMMY_JAR_FILE = DeploymentUtil.createTempFile();
             new JarOutputStream(new FileOutputStream(DeploymentUtil.DUMMY_JAR_FILE), new
Manifest()).close();
@@ -223,7 +225,25 @@
             return new File(baseDir, path).toURL();
         } else {
             String urlString = "jar:" + new File(jarFile.getName()).toURL() + "!/" + path;
-            return new URL(urlString);
+            if(jarUrlRewrite) {
+                // To prevent the lockout of archive, instead of returning a jar url, write
the content to a
+                // temp file and return the url of that file.
+                File tempFile = null;
+                try {
+                    tempFile = toTempFile(new URL(urlString));
+                } catch (IOException e) {
+                    // The JarEntry does not exist!
+                    // Return url of a file that does not exist.
+                    try {
+                        tempFile = createTempFile();
+                        tempFile.delete();
+                    } catch (IOException ignored) {
+                    }
+                 }
+                return tempFile.toURL();
+            } else {
+                return new URL(urlString);
+            }
         }
     }
 



Mime
View raw message