Author: kfujino Date: Mon Aug 29 11:08:42 2011 New Revision: 1162735 URL: http://svn.apache.org/viewvc?rev=1162735&view=rev Log: Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=51736. Make rpcTimeout configurable in BackupManager.
Modified: tomcat/tc7.0.x/trunk/java/org/apache/catalina/ha/session/BackupManager.java tomcat/tc7.0.x/trunk/java/org/apache/catalina/ha/session/mbeans-descriptors.xml tomcat/tc7.0.x/trunk/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml tomcat/tc7.0.x/trunk/webapps/docs/config/cluster-manager.xml Modified: tomcat/tc7.0.x/trunk/java/org/apache/catalina/ha/session/BackupManager.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/ha/session/BackupManager.java?rev=1162735&r1=1162734&r2=1162735&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/java/org/apache/catalina/ha/session/BackupManager.java (original) +++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/ha/session/BackupManager.java Mon Aug 29 11:08:42 2011 @@ -67,6 +67,11 @@ public class BackupManager extends Clust 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() * */ @@ -158,7 +163,7 @@ public class BackupManager extends Clust CatalinaCluster catclust = cluster; LazyReplicatedMap map = new LazyReplicatedMap(this, catclust.getChannel(), - DEFAULT_REPL_TIMEOUT, + rpcTimeout, getMapName(), getClassLoaders()); map.setChannelSendOptions(mapSendOptions); @@ -238,6 +243,14 @@ public class BackupManager extends Clust return mapSendOptions; } + public void setRpcTimeout(long rpcTimeout) { + this.rpcTimeout = rpcTimeout; + } + + public long getRpcTimeout() { + return rpcTimeout; + } + @Override public String[] getInvalidatedSessions() { return new String[0]; @@ -252,6 +265,7 @@ public class BackupManager extends Clust result.notifyListenersOnReplication = notifyListenersOnReplication; result.mapSendOptions = mapSendOptions; result.maxActiveSessions = maxActiveSessions; + result.rpcTimeout = rpcTimeout; return result; } Modified: tomcat/tc7.0.x/trunk/java/org/apache/catalina/ha/session/mbeans-descriptors.xml URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/ha/session/mbeans-descriptors.xml?rev=1162735&r1=1162734&r2=1162735&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/java/org/apache/catalina/ha/session/mbeans-descriptors.xml (original) +++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/ha/session/mbeans-descriptors.xml Mon Aug 29 11:08:42 2011 @@ -539,6 +539,10 @@ name="rejectedSessions" description="Number of sessions we rejected due to maxActive beeing reached" type="int"/> + <attribute + name="rpcTimeout" + description="Timeout for RPC messages, how long we will wait for a reply" + type="long"/> <operation name="expireSession" description="Expired the given session" 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=1162735&r1=1162734&r2=1162735&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 Aug 29 11:08:42 2011 @@ -305,14 +305,20 @@ public abstract class AbstractReplicated * @throws ChannelException */ protected void broadcast(int msgtype, boolean rpc) throws ChannelException { + // No destination. + if (channel.getMembers().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()); + 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 0 replies, probably a timeout."); } } else { channel.send(channel.getMembers(),msg,channelSendOptions); 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=1162735&r1=1162734&r2=1162735&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original) +++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Mon Aug 29 11:08:42 2011 @@ -132,6 +132,14 @@ </fix> </changelog> </subsection> + <subsection name="Cluster"> + <changelog> + <add> + <bug>51736</bug>: Make rpcTimeout configurable in BackupManager. + (kfujino) + </add> + </changelog> + </subsection> <subsection name="Web applications"> <changelog> <fix> Modified: tomcat/tc7.0.x/trunk/webapps/docs/config/cluster-manager.xml URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/config/cluster-manager.xml?rev=1162735&r1=1162734&r2=1162735&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/webapps/docs/config/cluster-manager.xml (original) +++ tomcat/tc7.0.x/trunk/webapps/docs/config/cluster-manager.xml Mon Aug 29 11:08:42 2011 @@ -132,6 +132,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