geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r910254 - /geronimo/server/trunk/plugins/wab/geronimo-web-extender/src/main/java/org/apache/geronimo/osgi/web/extender/WebContainerExtender.java
Date Mon, 15 Feb 2010 16:37:00 GMT
Author: gawor
Date: Mon Feb 15 16:36:59 2010
New Revision: 910254

URL: http://svn.apache.org/viewvc?rev=910254&view=rev
Log:
GERONIMO-5030: make sure not to redeploy queued web apps on extender shutdown

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=910254&r1=910253&r2=910254&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
Mon Feb 15 16:36:59 2010
@@ -75,6 +75,7 @@
     private final Collection<? extends Repository> repositories;
     private final ConfigurationManager configurationManager;
     
+    private boolean stopped;
     private Map<String, WebApplications> contextPathMap;
     private WebContainerEventDispatcher eventDispatcher;
     private BundleTracker bt;
@@ -147,6 +148,7 @@
     public void start(BundleContext context) {
         LOGGER.debug("Starting web container extender...");
 
+        stopped = false;
         executor = Executors.newFixedThreadPool(3);
         contextPathMap = Collections.synchronizedMap(new HashMap<String, WebApplications>());
 
         eventDispatcher = new WebContainerEventDispatcher(context);
@@ -201,6 +203,7 @@
     public void stop(BundleContext context) {
         LOGGER.debug("Stopping web container extender...");
         
+        stopped = true;
         if (bt != null) {
             bt.close();
         }
@@ -262,7 +265,7 @@
  
     protected void unregisterWebApplication(WebApplication wab) {
         WebApplications webApplications = contextPathMap.get(wab.getContextPath());
-        webApplications.unregister(wab);
+        webApplications.unregister(wab, !stopped);
     }
 
     public void doFail() {
@@ -304,20 +307,21 @@
             }
         }
         
-        public synchronized void unregister(WebApplication webApp) {
+        public synchronized void unregister(WebApplication webApp, boolean redeploy) {
             if (deployed == webApp) {
-                WebApplication candidate = null;
-                for (WebApplication app : waiting) {
-                    if (candidate == null || candidate.getBundle().getBundleId() > app.getBundle().getBundleId())
{
-                        candidate = app;
+                deployed = null;
+                if (redeploy) {
+                    WebApplication candidate = null;
+                    for (WebApplication app : waiting) {
+                        if (candidate == null || candidate.getBundle().getBundleId() >
app.getBundle().getBundleId()) {
+                            candidate = app;
+                        }
+                    }
+                    if (candidate != null) {
+                        waiting.remove(candidate);
+                        deployed = candidate;
+                        deployed.schedule();
                     }
-                }
-                if (candidate == null) {
-                    deployed = null;
-                } else {
-                    waiting.remove(candidate);
-                    deployed = candidate;
-                    deployed.schedule();
                 }
             } else {
                 waiting.remove(webApp);



Mime
View raw message