Author: kfujino
Date: Wed Aug 31 02:00:15 2011
New Revision: 1163469

URL: http://svn.apache.org/viewvc?rev=1163469&view=rev
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=51736.
Make rpcTimeout configurable in BackupManager.

Modified:
    tomcat/tc6.0.x/trunk/STATUS.txt
    tomcat/tc6.0.x/trunk/java/org/apache/catalina/ha/session/BackupManager.java
    
tomcat/tc6.0.x/trunk/java/org/apache/catalina/ha/session/mbeans-descriptors.xml
    
tomcat/tc6.0.x/trunk/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java
    tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml
    tomcat/tc6.0.x/trunk/webapps/docs/config/cluster-manager.xml

Modified: tomcat/tc6.0.x/trunk/STATUS.txt
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/STATUS.txt?rev=1163469&r1=1163468&r2=1163469&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/STATUS.txt (original)
+++ tomcat/tc6.0.x/trunk/STATUS.txt Wed Aug 31 02:00:15 2011
@@ -125,13 +125,3 @@ PATCHES PROPOSED TO BACKPORT:
   https://issues.apache.org/bugzilla/attachment.cgi?id=27438
   +1: kkolinko, markt
   -1:
-
-* Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=51736
-  Make rpcTimeout configurable in BackupManager.
-  http://svn.apache.org/viewvc?view=revision&revision=1162735
-  +1: kfujino, kkolinko, markt
-  -1:
-  Additional patch:
-  http://svn.apache.org/viewvc?rev=1162769&view=rev
-  +1: kkolinko, kfujino, markt
-  -1:

Modified: 
tomcat/tc6.0.x/trunk/java/org/apache/catalina/ha/session/BackupManager.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/ha/session/BackupManager.java?rev=1163469&r1=1163468&r2=1163469&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/catalina/ha/session/BackupManager.java 
(original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/ha/session/BackupManager.java 
Wed Aug 31 02:00:15 2011
@@ -65,6 +65,11 @@ public class BackupManager extends Stand
     private int mapSendOptions = 
Channel.SEND_OPTIONS_SYNCHRONIZED_ACK|Channel.SEND_OPTIONS_USE_ACK;
 
     /**
+     * Timeout for RPC messages.
+     */
+    private long rpcTimeout = DEFAULT_REPL_TIMEOUT;
+
+    /**
      * Constructor, just calls super()
      *
      */
@@ -197,7 +202,7 @@ public class BackupManager extends Stand
             CatalinaCluster catclust = (CatalinaCluster)cluster;
             LazyReplicatedMap map = new LazyReplicatedMap(this,
                                                           
catclust.getChannel(),
-                                                          DEFAULT_REPL_TIMEOUT,
+                                                          rpcTimeout,
                                                           getMapName(),
                                                           getClassLoaders());
             map.setChannelSendOptions(mapSendOptions);
@@ -277,6 +282,14 @@ public class BackupManager extends Stand
         return mapSendOptions;
     }
 
+    public void setRpcTimeout(long rpcTimeout) {
+        this.rpcTimeout = rpcTimeout;
+    }
+
+    public long getRpcTimeout() {
+        return rpcTimeout;
+    }
+
     public String[] getInvalidatedSessions() {
         return new String[0];
     }
@@ -289,6 +302,7 @@ public class BackupManager extends Stand
         result.notifyListenersOnReplication = notifyListenersOnReplication;
         result.mapSendOptions = mapSendOptions;
         result.maxActiveSessions = maxActiveSessions;
+        result.rpcTimeout = rpcTimeout;
         return result;
     }
 

Modified: 
tomcat/tc6.0.x/trunk/java/org/apache/catalina/ha/session/mbeans-descriptors.xml
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/ha/session/mbeans-descriptors.xml?rev=1163469&r1=1163468&r2=1163469&view=diff
==============================================================================
--- 
tomcat/tc6.0.x/trunk/java/org/apache/catalina/ha/session/mbeans-descriptors.xml 
(original)
+++ 
tomcat/tc6.0.x/trunk/java/org/apache/catalina/ha/session/mbeans-descriptors.xml 
Wed Aug 31 02:00:15 2011
@@ -557,6 +557,10 @@ created by this Manager"
       description="mapSendOptions"
       type="int"
       writeable="false"/>
+    <attribute
+      name="rpcTimeout"
+      description="Timeout for RPC messages, how long we will wait for a reply"
+      type="long"/>
     <operation
       name="listSessionIds"
       description="Return the list of active primary session ids"

Modified: 
tomcat/tc6.0.x/trunk/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java?rev=1163469&r1=1163468&r2=1163469&view=diff
==============================================================================
--- 
tomcat/tc6.0.x/trunk/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java
 (original)
+++ 
tomcat/tc6.0.x/trunk/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java
 Wed Aug 31 02:00:15 2011
@@ -306,14 +306,22 @@ public abstract class AbstractReplicated
      * @throws ChannelException
      */
     protected void broadcast(int msgtype, boolean rpc) throws ChannelException 
{
+        Member[] members = channel.getMembers();
+        // No destination.
+        if (members.length == 0 ) return;
         //send out a map membership message, only wait for the first reply
         MapMessage msg = new MapMessage(this.mapContextName, msgtype,
                                         false, null, null, null, 
channel.getLocalMember(false), null);
         if ( rpc) {
-            Response[] resp = rpcChannel.send(channel.getMembers(), msg, 
rpcChannel.FIRST_REPLY, (channelSendOptions),rpcTimeout);
-            for (int i = 0; i < resp.length; i++) {
-                mapMemberAdded(resp[i].getSource());
-                messageReceived(resp[i].getMessage(), resp[i].getSource());
+            Response[] resp = rpcChannel.send(members, msg,
+                    rpcChannel.FIRST_REPLY, (channelSendOptions), rpcTimeout);
+            if (resp.length > 0) {
+                for (int i = 0; i < resp.length; i++) {
+                    mapMemberAdded(resp[i].getSource());
+                    messageReceived(resp[i].getMessage(), resp[i].getSource());
+                }
+            } else {
+                log.warn("broadcast received 0 replies, probably a timeout.");
             }
         } else {
             channel.send(channel.getMembers(),msg,channelSendOptions);

Modified: tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml?rev=1163469&r1=1163468&r2=1163469&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml Wed Aug 31 02:00:15 2011
@@ -68,6 +68,14 @@
       </fix>
     </changelog>
   </subsection>
+  <subsection name="Cluster">
+    <changelog>
+      <add>
+        <bug>51736</bug>: Make rpcTimeout configurable in BackupManager. 
+        (kfujino)
+      </add>
+    </changelog>
+  </subsection>
 </section>
 <section name="Tomcat 6.0.33 (jfclere)" rtext="released 2011-08-18">
   <subsection name="Catalina">

Modified: tomcat/tc6.0.x/trunk/webapps/docs/config/cluster-manager.xml
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/webapps/docs/config/cluster-manager.xml?rev=1163469&r1=1163468&r2=1163469&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/webapps/docs/config/cluster-manager.xml (original)
+++ tomcat/tc6.0.x/trunk/webapps/docs/config/cluster-manager.xml Wed Aug 31 
02:00:15 2011
@@ -141,6 +141,11 @@
         sessions where the current node is the primary node for the session are
         considered active sessions.
       </attribute>
+      <attribute name="rpcTimeout" required="false">
+        Timeout for RPC message used for broadcast and transfer state from 
+        another map.
+        Default value is <code>15000</code> milliseconds.
+      </attribute>
     </attributes>
   </subsection>
 </section>



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

Reply via email to