Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=49924
authorkfujino <kfujino@13f79535-47bb-0310-9956-ffa450edef68>
Tue, 14 Sep 2010 07:49:33 +0000 (07:49 +0000)
committerkfujino <kfujino@13f79535-47bb-0310-9956-ffa450edef68>
Tue, 14 Sep 2010 07:49:33 +0000 (07:49 +0000)
When non-primary node changes into a primary node, make sure isPrimarySession is changed to true.

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@996778 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/catalina/ha/session/BackupManager.java
java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java
webapps/docs/changelog.xml

index 01b7b0e..bc510f2 100644 (file)
@@ -114,6 +114,7 @@ public class BackupManager extends ClusterManagerBase implements MapOwner {
             DeltaSession session = (DeltaSession)value;
             synchronized (session) {
                 session.access();
+                session.setPrimarySession(true);
                 session.endAccess();
             }
         }
index c4f4697..9b42346 100644 (file)
@@ -892,12 +892,16 @@ public abstract class AbstractReplicatedMap extends ConcurrentHashMap implements
                     if ( dest!=null && dest.length >0) {
                         getChannel().send(dest, msg, getChannelSendOptions());
                     }
+                    if ( entry.getValue() != null && entry.getValue() instanceof ReplicatedMapEntry ) {
+                        ReplicatedMapEntry val = (ReplicatedMapEntry)entry.getValue();
+                        val.setOwner(getMapOwner());   
+                    }
                 }
                 entry.setPrimary(channel.getLocalMember(false));
                 entry.setBackupNodes(backup);
                 entry.setBackup(false);
                 entry.setProxy(false);
-
+                getMapOwner().objectMadePrimay(key, entry.getValue());
 
             } catch (Exception x) {
                 log.error("Unable to replicate out data for a LazyReplicatedMap.get operation", x);
@@ -905,12 +909,6 @@ public abstract class AbstractReplicatedMap extends ConcurrentHashMap implements
             }
         }
         if (log.isTraceEnabled()) log.trace("Requesting id:"+key+" result:"+entry.getValue());
-        if ( entry.getValue() != null && entry.getValue() instanceof ReplicatedMapEntry ) {
-            ReplicatedMapEntry val = (ReplicatedMapEntry)entry.getValue();
-            //hack, somehow this is not being set above
-            val.setOwner(getMapOwner());
-            
-        }
         return entry.getValue();
     }    
 
index 3400931..a8929d6 100644 (file)
         session before the current request has a chance to send the replication
         message. (markt)
       </fix>
+      <fix>
+        <bug>49924</bug>: When non-primary node changes into a primary node, 
+        make sure isPrimarySession is changed to true. (kfujino)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Web applications">