Author: markt Date: Thu Jul 29 18:32:58 2010 New Revision: 980535 URL: http://svn.apache.org/viewvc?rev=980535&view=rev Log: Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=49407 Make BackupManager and DeltaManager handle primary and backup sessions consistently
Modified: tomcat/trunk/java/org/apache/catalina/session/ManagerBase.java tomcat/trunk/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java tomcat/trunk/webapps/docs/changelog.xml Modified: tomcat/trunk/java/org/apache/catalina/session/ManagerBase.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/session/ManagerBase.java?rev=980535&r1=980534&r2=980535&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/catalina/session/ManagerBase.java (original) +++ tomcat/trunk/java/org/apache/catalina/session/ManagerBase.java Thu Jul 29 18:32:58 2010 @@ -772,7 +772,7 @@ public abstract class ManagerBase extend public void add(Session session) { sessions.put(session.getIdInternal(), session); - int size = sessions.size(); + int size = getActiveSessions(); if( size > maxActive ) { synchronized(maxActiveUpdateLock) { if( size > maxActive ) { @@ -811,7 +811,7 @@ public abstract class ManagerBase extend public Session createSession(String sessionId) { if ((maxActiveSessions >= 0) && - (sessions.size() >= maxActiveSessions)) { + (getActiveSessions() >= maxActiveSessions)) { rejectedSessions++; throw new IllegalStateException( sm.getString("managerBase.createSession.ise")); Modified: tomcat/trunk/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java?rev=980535&r1=980534&r2=980535&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java (original) +++ tomcat/trunk/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java Thu Jul 29 18:32:58 2010 @@ -998,7 +998,7 @@ public abstract class AbstractReplicated while (i.hasNext()) { Map.Entry<?,?> e = i.next(); MapEntry entry = (MapEntry) super.get(e.getKey()); - if (entry!=null && entry.isPrimary() && value.equals(entry.getValue())) return true; + if (entry!=null && entry.isActive() && value.equals(entry.getValue())) return true; }//while return false; }//end if @@ -1035,7 +1035,7 @@ public abstract class AbstractReplicated Map.Entry<?,?> e = i.next(); Object key = e.getKey(); MapEntry entry = (MapEntry)super.get(key); - if ( entry != null && entry.isPrimary() ) { + if ( entry != null && entry.isActive() ) { set.add(new MapEntry(key, entry.getValue())); } } @@ -1052,7 +1052,7 @@ public abstract class AbstractReplicated Map.Entry<?,?> e = i.next(); Object key = e.getKey(); MapEntry entry = (MapEntry)super.get(key); - if ( entry!=null && entry.isPrimary() ) set.add(key); + if ( entry!=null && entry.isActive() ) set.add(key); } return Collections.unmodifiableSet(set); @@ -1069,7 +1069,7 @@ public abstract class AbstractReplicated Map.Entry<?,?> e = it.next(); if ( e != null ) { MapEntry entry = (MapEntry) super.get(e.getKey()); - if (entry!=null && entry.isPrimary() && entry.getValue() != null) counter++; + if (entry!=null && entry.isActive() && entry.getValue() != null) counter++; } } return counter; @@ -1087,7 +1087,7 @@ public abstract class AbstractReplicated while ( i.hasNext() ) { Map.Entry<?,?> e = i.next(); MapEntry entry = (MapEntry)super.get(e.getKey()); - if (entry!=null && entry.isPrimary() && entry.getValue()!=null) values.add(entry.getValue()); + if (entry!=null && entry.isActive() && entry.getValue()!=null) values.add(entry.getValue()); } return Collections.unmodifiableCollection(values); } @@ -1135,9 +1135,13 @@ public abstract class AbstractReplicated } public boolean isPrimary() { - return ( (!proxy) && (!backup)); + return (!proxy && !backup); } + public boolean isActive() { + return !proxy; + } + public void setProxy(boolean proxy) { this.proxy = proxy; } Modified: tomcat/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=980535&r1=980534&r2=980535&view=diff ============================================================================== --- tomcat/trunk/webapps/docs/changelog.xml (original) +++ tomcat/trunk/webapps/docs/changelog.xml Thu Jul 29 18:32:58 2010 @@ -239,6 +239,11 @@ <code>SimpleTcpReplicationManager.startInternal()</code>. (markt) </fix> <fix> + <bug>49407</bug>: Change the BackupManager so it is consistent with + DeltaManager and reports both primary and backup sessions when active + sessions are requested. (markt) + </fix> + <fix> <bug>49445</bug>: When session ID is changed after authentication, ensure the DeltaManager replicates the change in ID to the other nodes in the cluster. (kfujino) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org