geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r1148540 - /geronimo/server/trunk/plugins/wab/geronimo-web-extender/src/main/java/org/apache/geronimo/osgi/web/extender/WebContainerExtender.java
Date Tue, 19 Jul 2011 21:20:22 GMT
Author: gawor
Date: Tue Jul 19 21:20:21 2011
New Revision: 1148540

URL: http://svn.apache.org/viewvc?rev=1148540&view=rev
Log:
GERONIMO-6084: Option for deploying WABs synchronously

Modified:
    geronimo/server/trunk/plugins/wab/geronimo-web-extender/src/main/java/org/apache/geronimo/osgi/web/extender/WebContainerExtender.java

Modified: geronimo/server/trunk/plugins/wab/geronimo-web-extender/src/main/java/org/apache/geronimo/osgi/web/extender/WebContainerExtender.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/wab/geronimo-web-extender/src/main/java/org/apache/geronimo/osgi/web/extender/WebContainerExtender.java?rev=1148540&r1=1148539&r2=1148540&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/wab/geronimo-web-extender/src/main/java/org/apache/geronimo/osgi/web/extender/WebContainerExtender.java
(original)
+++ geronimo/server/trunk/plugins/wab/geronimo-web-extender/src/main/java/org/apache/geronimo/osgi/web/extender/WebContainerExtender.java
Tue Jul 19 21:20:21 2011
@@ -62,9 +62,11 @@ import org.slf4j.LoggerFactory;
 @GBean
 public class WebContainerExtender implements GBeanLifecycle {
 
-
     private static final Logger LOGGER = LoggerFactory.getLogger(WebContainerExtender.class);
 
+    private static final String SYNCHRONOUS_HEADER = "Synchronous-Deploy";
+    private static final String SYNCHRONOUS_PROPERTY = "org.apache.geronimo.osgi.web.extender.synchronous";
+    
     private final Kernel kernel;
     private final BundleContext bundleContext;
     private final Environment defaultEnvironment;
@@ -307,10 +309,25 @@ public class WebContainerExtender implem
             this.waiting = new LinkedList<WebApplication>();
         }
         
+        private boolean isSynchronous(Bundle bundle) {
+            String property = (String) bundle.getHeaders().get(SYNCHRONOUS_HEADER);     
     
+            if (property == null) {
+                property = bundle.getBundleContext().getProperty(SYNCHRONOUS_PROPERTY);
+            }
+            return Boolean.parseBoolean(property);
+        }
+        
         public synchronized Collection<Long> register(WebApplication webApp) {
             if (deployed == null) {
                 deployed = webApp;
-                deployed.schedule();
+                Bundle bundle = webApp.getBundle();
+                if (isSynchronous(bundle)) {
+                    LOGGER.debug("Deploying web application bundle {} synchronously.", bundle.getSymbolicName());
+                    deployed.run();
+                } else {
+                    LOGGER.debug("Deploying web application bundle {} asynchronously.", bundle.getSymbolicName());
+                    deployed.schedule();
+                }
                 return Collections.emptyList();
             } else {
                 waiting.add(webApp);



Mime
View raw message