tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1382845 - in /tomcat/tc7.0.x/trunk: ./ java/org/apache/catalina/startup/HostConfig.java
Date Mon, 10 Sep 2012 13:51:15 GMT
Author: markt
Date: Mon Sep 10 13:51:15 2012
New Revision: 1382845

URL: http://svn.apache.org/viewvc?rev=1382845&view=rev
Log:
Take account of clusters and persistent session managers when checking if all sessions have
expired.

Modified:
    tomcat/tc7.0.x/trunk/   (props changed)
    tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/HostConfig.java

Propchange: tomcat/tc7.0.x/trunk/
------------------------------------------------------------------------------
  Merged /tomcat/trunk:r1382842

Modified: tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/HostConfig.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/HostConfig.java?rev=1382845&r1=1382844&r2=1382845&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/HostConfig.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/HostConfig.java Mon Sep 10 13:51:15
2012
@@ -48,6 +48,7 @@ import javax.management.ObjectName;
 
 import org.apache.catalina.Container;
 import org.apache.catalina.Context;
+import org.apache.catalina.DistributedManager;
 import org.apache.catalina.Engine;
 import org.apache.catalina.Globals;
 import org.apache.catalina.Host;
@@ -1482,21 +1483,31 @@ public class HostConfig
                         currentContext.getState().isAvailable() &&
                         !isServiced(previous.getName())) {
                     Manager manager = previousContext.getManager();
-                    if (manager != null && manager.getActiveSessions() == 0) {
-                        if (log.isInfoEnabled()) {
-                            log.info(sm.getString("hostConfig.undeployVersion",
-                                    previous.getName()));
+                    if (manager != null) {
+                        int sessionCount;
+                        if (manager instanceof DistributedManager) {
+                            sessionCount = ((DistributedManager)
+                                    manager).getActiveSessionsFull();
+                        } else {
+                            sessionCount = manager.getActiveSessions();
+                        }
+                        if (sessionCount == 0) {
+                            if (log.isInfoEnabled()) {
+                                log.info(sm.getString(
+                                        "hostConfig.undeployVersion",
+                                        previous.getName()));
+                            }
+                            DeployedApplication app =
+                                    deployed.get(previous.getName());
+                            String[] resources =
+                                    app.redeployResources.keySet().toArray(
+                                            new String[0]);
+                            // Version is unused - undeploy it completely
+                            // The -1 is a 'trick' to ensure all redeploy
+                            // resources are removed
+                            deleteRedeployResources(app, resources, -1,
+                                    true);
                         }
-                        DeployedApplication app =
-                                deployed.get(previous.getName());
-                        String[] resources =
-                                app.redeployResources.keySet().toArray(
-                                        new String[0]);
-                        // Version is unused - undeploy it completely
-                        // The -1 is a 'trick' to ensure all redeploy resources
-                        // are removed
-                        deleteRedeployResources(app, resources, -1,
-                                true);
                     }
                 }
             }



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message