tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject svn commit: r1185996 - /openejb/trunk/openejb/assembly/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/TomcatWebAppBuilder.java
Date Wed, 19 Oct 2011 06:58:59 GMT
Author: rmannibucau
Date: Wed Oct 19 06:58:58 2011
New Revision: 1185996

URL: http://svn.apache.org/viewvc?rev=1185996&view=rev
Log:
OPENEJB-1523 trying to avoid the OutOfMemoryError

Modified:
    openejb/trunk/openejb/assembly/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/TomcatWebAppBuilder.java

Modified: openejb/trunk/openejb/assembly/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/TomcatWebAppBuilder.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/assembly/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/TomcatWebAppBuilder.java?rev=1185996&r1=1185995&r2=1185996&view=diff
==============================================================================
--- openejb/trunk/openejb/assembly/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/TomcatWebAppBuilder.java
(original)
+++ openejb/trunk/openejb/assembly/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/TomcatWebAppBuilder.java
Wed Oct 19 06:58:58 2011
@@ -231,7 +231,23 @@ public class TomcatWebAppBuilder impleme
                 
                 // TODO: instead of storing deployers, we could just lookup the right hostconfig
for the server.
                 final HostConfig deployer = deployers.get(host);
-                if (hosts.containsKey(host)){
+                boolean isReady = false;
+                if (deployer != null) {
+                    // TODO: find something more sexy
+                    try {
+                        isReady = deployer.getClass().getDeclaredField("host").get(deployer)
!= null;
+                    } catch (Exception e) {
+                        // no-op
+                    }
+                }
+                if (deployer != null && isReady) { // if not ready using directly
host to avoid a NPE
+                    // host isn't set until we call deployer.manageApp, so pass it
+                    // ?? host is set through an event and it can be null here :(
+                    ContextInfo contextInfo = addContextInfo(host, standardContext);
+                    contextInfo.appInfo = appInfo;
+                    contextInfo.deployer = deployer;
+                    deployer.manageApp(standardContext);
+                } else if (hosts.containsKey(host)) {
                     Host theHost = hosts.get(host);
 
                     ContextInfo contextInfo = addContextInfo(host, standardContext);
@@ -239,13 +255,6 @@ public class TomcatWebAppBuilder impleme
                     contextInfo.host = theHost;
 
                     theHost.addChild(standardContext);
-                } else if (deployer != null) {
-                    // host isn't set until we call deployer.manageApp, so pass it
-                    // ?? host is set through an event and it can be null here :(
-                    ContextInfo contextInfo = addContextInfo(host, standardContext);
-                    contextInfo.appInfo = appInfo;
-                    contextInfo.deployer = deployer;
-                    deployer.manageApp(standardContext);
                 }
             }
         }



Mime
View raw message