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 04:48:21 UTC
svn commit: r1742878 - in /tomcat/tc7.0.x/trunk:
java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java
webapps/docs/changelog.xml
Author: kfujino
Date: Mon May 9 04:48:21 2016
New Revision: 1742878
URL: http://svn.apache.org/viewvc?rev=1742878&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/tc7.0.x/trunk/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java
tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
Modified: tomcat/tc7.0.x/trunk/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java?rev=1742878&r1=1742877&r2=1742878&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java Mon May 9 04:48:21 2016
@@ -149,6 +149,11 @@ public abstract class AbstractReplicated
*/
protected transient String mapname = "";
+ /**
+ * State of this map
+ */
+ private volatile transient State state = State.NEW;
+
//------------------------------------------------------------------------------
// map owner interface
//------------------------------------------------------------------------------
@@ -229,7 +234,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);
@@ -244,6 +248,7 @@ public abstract class AbstractReplicated
throw new RuntimeException("Unable to start replicated map.",x);
}
}
+ this.state = State.INITIALIZED;
long complete = System.currentTimeMillis() - start;
if (log.isInfoEnabled())
log.info("AbstractReplicatedMap[" +mapContextName + "] initialization was completed in " + complete + " ms.");
@@ -339,6 +344,7 @@ public abstract class AbstractReplicated
}
public void breakdown() {
+ this.state = State.DESTROYED;
if (this.rpcChannel != null) {
this.rpcChannel.breakdown();
}
@@ -887,7 +893,7 @@ public abstract class AbstractReplicated
@Override
public void heartbeat() {
try {
- ping(accessTimeout);
+ if (this.state.isAvailable()) ping(accessTimeout);
}catch ( Exception x ) {
log.error("Unable to send AbstractReplicatedMap.ping message",x);
}
@@ -1624,4 +1630,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/tc7.0.x/trunk/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1742878&r1=1742877&r2=1742878&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Mon May 9 04:48:21 2016
@@ -154,6 +154,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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org