Author: kfujino Date: Mon May 9 04:44:46 2016 New Revision: 1742875 URL: http://svn.apache.org/viewvc?rev=1742875&view=rev Log: Implement map state in the replication map. Ensure that the ping is not executed during the start/stop of the replication map.
Modified: tomcat/trunk/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java 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=1742875&r1=1742874&r2=1742875&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 04:44:46 2016 @@ -144,6 +144,11 @@ public abstract class AbstractReplicated */ protected transient String mapname = ""; + /** + * State of this map + */ + private volatile transient State state = State.NEW; + //------------------------------------------------------------------------------ // map owner interface //------------------------------------------------------------------------------ @@ -225,7 +230,6 @@ public abstract class AbstractReplicated //listen for membership notifications this.channel.addMembershipListener(this); - try { //broadcast our map, this just notifies other members of our existence broadcast(MapMessage.MSG_INIT, true); @@ -240,6 +244,7 @@ public abstract class AbstractReplicated throw new RuntimeException(sm.getString("abstractReplicatedMap.unableStart"),x); } } + this.state = State.INITIALIZED; long complete = System.currentTimeMillis() - start; if (log.isInfoEnabled()) log.info(sm.getString("abstractReplicatedMap.init.completed", @@ -336,6 +341,7 @@ public abstract class AbstractReplicated } public void breakdown() { + this.state = State.DESTROYED; if (this.rpcChannel != null) { this.rpcChannel.breakdown(); } @@ -888,7 +894,7 @@ public abstract class AbstractReplicated @Override public void heartbeat() { try { - ping(accessTimeout); + if (this.state.isAvailable()) ping(accessTimeout); }catch ( Exception x ) { log.error(sm.getString("abstractReplicatedMap.heartbeat.failed"),x); } @@ -1587,4 +1593,19 @@ public abstract class AbstractReplicated this.accessTimeout = accessTimeout; } + private static enum State { + NEW(false), + INITIALIZED(true), + DESTROYED(false); + + private final boolean available; + + private State(boolean available) { + this.available = available; + } + + public boolean isAvailable() { + return available; + } + } } \ No newline at end of file Modified: tomcat/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1742875&r1=1742874&r2=1742875&view=diff ============================================================================== --- tomcat/trunk/webapps/docs/changelog.xml (original) +++ tomcat/trunk/webapps/docs/changelog.xml Mon May 9 04:44:46 2016 @@ -362,6 +362,13 @@ Ensure that clear the channel instance from channel services when stopping channel. (kfujino) </fix> + <add> + Implement map state in the replication map. (kfujino) + </add> + <fix> + Ensure that the ping is not executed during the start/stop of the + replication map. (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