If there is no primary node, then let the expiration time apply to the backup node
authorfhanik <fhanik@13f79535-47bb-0310-9956-ffa450edef68>
Thu, 9 Aug 2007 19:45:53 +0000 (19:45 +0000)
committerfhanik <fhanik@13f79535-47bb-0310-9956-ffa450edef68>
Thu, 9 Aug 2007 19:45:53 +0000 (19:45 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@564356 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java

index 9a1df18..fb655a2 100644 (file)
@@ -978,7 +978,8 @@ public abstract class AbstractReplicatedMap extends ConcurrentHashMap implements
                 Map.Entry e = (Map.Entry)i.next();
                 Object key = e.getKey();
                 MapEntry entry = (MapEntry)super.get(key);
-                if ( entry.isPrimary() ) set.add(entry.getValue());
+                if ( entry != null && entry.isPrimary() ) set.add(entry.getValue());
+                else if ( entry != null && entry.getPrimary() == null && entry.isBackup() ) set.add(entry.getValue());
             }
             return Collections.unmodifiableSet(set);
         }
@@ -992,7 +993,8 @@ public abstract class AbstractReplicatedMap extends ConcurrentHashMap implements
                 Map.Entry e = (Map.Entry)i.next();
                 Object key = e.getKey();
                 MapEntry entry = (MapEntry)super.get(key);
-                if ( entry.isPrimary() ) set.add(key);
+                if ( entry!=null && entry.isPrimary() ) set.add(key);
+                else if ( entry != null && entry.getPrimary() == null && entry.isBackup() ) set.add(key);
             }
             return Collections.unmodifiableSet(set);
 
@@ -1009,6 +1011,7 @@ public abstract class AbstractReplicatedMap extends ConcurrentHashMap implements
                 if ( e != null ) {
                     MapEntry entry = (MapEntry) super.get(e.getKey());
                     if (entry!=null && entry.isPrimary() && entry.getValue() != null) counter++;
+                    else if ( entry != null && entry.getPrimary() == null && entry.isBackup() ) counter++;
                 }
             }
             return counter;