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:46:02 UTC

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

Author: kfujino
Date: Mon May  9 04:46:02 2016
New Revision: 1742876

URL: http://svn.apache.org/viewvc?rev=1742876&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/tc8.5.x/trunk/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java
    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=1742876&r1=1742875&r2=1742876&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 04:46:02 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/tc8.5.x/trunk/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/tc8.5.x/trunk/webapps/docs/changelog.xml?rev=1742876&r1=1742875&r2=1742876&view=diff
==============================================================================
--- tomcat/tc8.5.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc8.5.x/trunk/webapps/docs/changelog.xml Mon May  9 04:46:02 2016
@@ -353,6 +353,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