You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by kf...@apache.org on 2016/05/09 08:34:13 UTC

svn commit: r1742891 - in /tomcat/tc8.5.x/trunk: java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java java/org/apache/catalina/tribes/tipis/LocalStrings.properties webapps/docs/changelog.xml

Author: kfujino
Date: Mon May  9 08:34:12 2016
New Revision: 1742891

URL: http://svn.apache.org/viewvc?rev=1742891&view=rev
Log:
In ping processing in the replication map, send not the INIT message but the newly introduced PING message.

Modified:
    tomcat/tc8.5.x/trunk/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java
    tomcat/tc8.5.x/trunk/java/org/apache/catalina/tribes/tipis/LocalStrings.properties
    tomcat/tc8.5.x/trunk/webapps/docs/changelog.xml

Modified: tomcat/tc8.5.x/trunk/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java
URL: http://svn.apache.org/viewvc/tomcat/tc8.5.x/trunk/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java?rev=1742891&r1=1742890&r2=1742891&view=diff
==============================================================================
--- tomcat/tc8.5.x/trunk/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java (original)
+++ tomcat/tc8.5.x/trunk/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java Mon May  9 08:34:12 2016
@@ -261,7 +261,7 @@ public abstract class AbstractReplicated
     protected void ping(long timeout) throws ChannelException {
         //send out a map membership message, only wait for the first reply
         MapMessage msg = new MapMessage(this.mapContextName,
-                                        MapMessage.MSG_INIT,
+                                        MapMessage.MSG_PING,
                                         false,
                                         null,
                                         null,
@@ -276,7 +276,20 @@ public abstract class AbstractReplicated
                                                   (channelSendOptions),
                                                   (int) accessTimeout);
                 for (int i = 0; i < resp.length; i++) {
-                    memberAlive(resp[i].getSource());
+                    MapMessage mapMsg = (MapMessage)resp[i].getMessage();
+                    try {
+                        mapMsg.deserialize(getExternalLoaders());
+                        State state = (State) mapMsg.getValue();
+                        if (state.isAvailable()) {
+                            memberAlive(resp[i].getSource());
+                        } else {
+                            if (log.isInfoEnabled())
+                                log.info(sm.getString("abstractReplicatedMap.mapMember.unavailable",
+                                        resp[i].getSource()));
+                        }
+                    } catch (ClassNotFoundException | IOException e) {
+                        log.error(sm.getString("abstractReplicatedMap.unable.deserialize.MapMessage"), e);
+                    }
                 }
             } catch (ChannelException ce) {
                 // Handle known failed members
@@ -575,6 +588,13 @@ public abstract class AbstractReplicated
             } //synchronized
         }
 
+        // ping
+        if (mapmsg.getMsgType() == MapMessage.MSG_PING) {
+            mapmsg.setValue(state);
+            mapmsg.setPrimary(channel.getLocalMember(false));
+            return mapmsg;
+        }
+
         return null;
 
     }
@@ -1374,6 +1394,7 @@ public abstract class AbstractReplicated
         public static final int MSG_STATE_COPY = 10;
         public static final int MSG_ACCESS = 11;
         public static final int MSG_NOTIFY_MAPMEMBER = 12;
+        public static final int MSG_PING = 13;
 
         private final byte[] mapId;
         private final int msgtype;
@@ -1413,6 +1434,7 @@ public abstract class AbstractReplicated
                 case MSG_COPY: return "MSG_COPY";
                 case MSG_ACCESS: return "MSG_ACCESS";
                 case MSG_NOTIFY_MAPMEMBER: return "MSG_NOTIFY_MAPMEMBER";
+                case MSG_PING: return "MSG_PING";
                 default : return "UNKNOWN";
             }
         }

Modified: tomcat/tc8.5.x/trunk/java/org/apache/catalina/tribes/tipis/LocalStrings.properties
URL: http://svn.apache.org/viewvc/tomcat/tc8.5.x/trunk/java/org/apache/catalina/tribes/tipis/LocalStrings.properties?rev=1742891&r1=1742890&r2=1742891&view=diff
==============================================================================
--- tomcat/tc8.5.x/trunk/java/org/apache/catalina/tribes/tipis/LocalStrings.properties (original)
+++ tomcat/tc8.5.x/trunk/java/org/apache/catalina/tribes/tipis/LocalStrings.properties Mon May  9 08:34:12 2016
@@ -37,6 +37,7 @@ abstractReplicatedMap.unsupport.operatio
 abstractReplicatedMap.mapMemberAdded.nullMember=Notified member is not registered in the membership:{0}.
 abstractReplicatedMap.mapMemberAdded.added=Map member added:{0}
 abstractReplicatedMap.leftOver.ignored=Message[{0}] is ignored.
+abstractReplicatedMap.mapMember.unavailable=Member[{0}] is not available yet.
 mapMessage.deserialize.error.key=Deserialization error of the MapMessage.key
 mapMessage.deserialize.error.value=Deserialization error of the MapMessage.value
 lazyReplicatedMap.unableReplicate.backup=Unable to replicate backup key:{0} to backup:{1}. Reason:{2}

Modified: tomcat/tc8.5.x/trunk/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/tc8.5.x/trunk/webapps/docs/changelog.xml?rev=1742891&r1=1742890&r2=1742891&view=diff
==============================================================================
--- tomcat/tc8.5.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc8.5.x/trunk/webapps/docs/changelog.xml Mon May  9 08:34:12 2016
@@ -360,6 +360,11 @@
         Ensure that the ping is not executed during the start/stop of the
         replication map. (kfujino)
       </fix>
+      <fix>
+        In ping processing in the replication map, send not the
+        <code>INIT</code> message but the newly introduced <code>PING</code>
+        message. (kfujino)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Other">



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