Author: kfujino Date: Mon May 9 08:32:48 2016 New Revision: 1742890 URL: http://svn.apache.org/viewvc?rev=1742890&view=rev Log: In ping processing in the replication map, send not the INIT message but the newly introduced PING message.
Modified: tomcat/trunk/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java tomcat/trunk/java/org/apache/catalina/tribes/tipis/LocalStrings.properties tomcat/trunk/webapps/docs/changelog.xml 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=1742890&r1=1742889&r2=1742890&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java (original) +++ tomcat/trunk/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java Mon May 9 08:32:48 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/trunk/java/org/apache/catalina/tribes/tipis/LocalStrings.properties URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/tribes/tipis/LocalStrings.properties?rev=1742890&r1=1742889&r2=1742890&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/catalina/tribes/tipis/LocalStrings.properties (original) +++ tomcat/trunk/java/org/apache/catalina/tribes/tipis/LocalStrings.properties Mon May 9 08:32:48 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/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1742890&r1=1742889&r2=1742890&view=diff ============================================================================== --- tomcat/trunk/webapps/docs/changelog.xml (original) +++ tomcat/trunk/webapps/docs/changelog.xml Mon May 9 08:32:48 2016 @@ -369,6 +369,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-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org