tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject [08/16] tomee git commit: TOMEE-1568 support overriding of a failed deployment in tomcat webappdeployer
Date Tue, 05 May 2015 05:50:28 GMT
TOMEE-1568 support overriding of a failed deployment in tomcat webappdeployer


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/b7eb5b01
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/b7eb5b01
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/b7eb5b01

Branch: refs/heads/fb_tomee2_owb16
Commit: b7eb5b01b07c16efc79c076006b20a7e214eb39e
Parents: 1959954
Author: Romain Manni-Bucau <rmannibucau@apache.org>
Authored: Wed Apr 29 22:59:17 2015 +0200
Committer: Mark Struberg <struberg@apache.org>
Committed: Mon May 4 19:00:19 2015 +0200

----------------------------------------------------------------------
 .../org/apache/openejb/assembler/DeployerEjb.java  |  7 +++++--
 .../apache/tomee/catalina/TomcatWebAppBuilder.java | 17 ++++++++++++++---
 2 files changed, 19 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/b7eb5b01/container/openejb-core/src/main/java/org/apache/openejb/assembler/DeployerEjb.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/main/java/org/apache/openejb/assembler/DeployerEjb.java
b/container/openejb-core/src/main/java/org/apache/openejb/assembler/DeployerEjb.java
index 908d14b..bc4d354 100644
--- a/container/openejb-core/src/main/java/org/apache/openejb/assembler/DeployerEjb.java
+++ b/container/openejb-core/src/main/java/org/apache/openejb/assembler/DeployerEjb.java
@@ -176,8 +176,11 @@ public class DeployerEjb implements Deployer {
             try {
                 final AppInfo appInfo = SystemInstance.get().getComponent(WebAppDeployer.class)
                         .deploy(host, contextRoot(properties, file.getAbsolutePath()), file);
-                saveIfNeeded(properties, file, appInfo);
-                return appInfo;
+                if (appInfo != null) {
+                    saveIfNeeded(properties, file, appInfo);
+                    return appInfo;
+                }
+                throw new OpenEJBException("can't deploy " + file.getAbsolutePath());
             } finally {
                 AUTO_DEPLOY.remove();
             }

http://git-wip-us.apache.org/repos/asf/tomee/blob/b7eb5b01/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/TomcatWebAppBuilder.java
----------------------------------------------------------------------
diff --git a/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/TomcatWebAppBuilder.java
b/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/TomcatWebAppBuilder.java
index 24a31e0..2ef7d8c 100644
--- a/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/TomcatWebAppBuilder.java
+++ b/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/TomcatWebAppBuilder.java
@@ -466,7 +466,7 @@ public class TomcatWebAppBuilder implements WebAppBuilder, ContextListener,
Pare
                 }
             }
 
-            if (getContextInfo(webApp.host, webApp.contextRoot) != null) {
+            if (isAlreadyDeployed(webApp)) {
                 continue;
             }
 
@@ -515,7 +515,7 @@ public class TomcatWebAppBuilder implements WebAppBuilder, ContextListener,
Pare
             appParam.setValue(webApp.moduleId);
             standardContext.addApplicationParameter(appParam);
 
-            if (getContextInfo(webApp.host, webApp.contextRoot) == null) {
+            if (!isAlreadyDeployed(webApp)) {
                 if (standardContext.getPath() == null) {
                     if (webApp.contextRoot != null && webApp.contextRoot.startsWith("/"))
{
                         standardContext.setPath(webApp.contextRoot);
@@ -542,7 +542,7 @@ public class TomcatWebAppBuilder implements WebAppBuilder, ContextListener,
Pare
                     webApp.contextRoot = "";
                 }
 
-                if (getContextInfo(webApp.host, webApp.contextRoot) != null) { // possible
because of the previous renaming
+                if (isAlreadyDeployed(webApp)) { // possible because of the previous renaming
                     continue;
                 }
 
@@ -580,6 +580,17 @@ public class TomcatWebAppBuilder implements WebAppBuilder, ContextListener,
Pare
         }
     }
 
+    private boolean isAlreadyDeployed(final WebAppInfo webApp) {
+        final ContextInfo contextInfo = getContextInfo(webApp.host, webApp.contextRoot);
+        if (contextInfo != null && contextInfo.standardContext != null &&
contextInfo.standardContext.getState() == LifecycleState.FAILED) {
+            synchronized (this) {
+                infos.remove(getId(webApp.host, webApp.contextRoot));
+            }
+            return false;
+        }
+        return contextInfo != null;
+    }
+
     private static boolean isParent(final ClassLoader parent, final ClassLoader child) {
         ClassLoader current = child;
         while (current != null) {


Mime
View raw message