Author: kfujino
Date: Mon Aug 29 10:30:38 2011
New Revision: 1162721
URL: http://svn.apache.org/viewvc?rev=1162721&view=rev
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=51736.
Make rpcTimeout configurable in BackupManager.
Modified:
tomcat/trunk/java/org/apache/catalina/ha/session/BackupManager.java
tomcat/trunk/java/org/apache/catalina/ha/session/mbeans-descriptors.xml
tomcat/trunk/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java
tomcat/trunk/webapps/docs/config/cluster-manager.xml
Modified: tomcat/trunk/java/org/apache/catalina/ha/session/BackupManager.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/ha/session/BackupManager.java?rev=1162721&r1=1162720&r2=1162721&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/ha/session/BackupManager.java
(original)
+++ tomcat/trunk/java/org/apache/catalina/ha/session/BackupManager.java Mon Aug
29 10:30:38 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/trunk/java/org/apache/catalina/ha/session/mbeans-descriptors.xml
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/ha/session/mbeans-descriptors.xml?rev=1162721&r1=1162720&r2=1162721&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/ha/session/mbeans-descriptors.xml
(original)
+++ tomcat/trunk/java/org/apache/catalina/ha/session/mbeans-descriptors.xml Mon
Aug 29 10:30:38 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/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=1162721&r1=1162720&r2=1162721&view=diff
==============================================================================
---
tomcat/trunk/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java
(original)
+++
tomcat/trunk/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java
Mon Aug 29 10:30:38 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/trunk/webapps/docs/config/cluster-manager.xml
URL:
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/config/cluster-manager.xml?rev=1162721&r1=1162720&r2=1162721&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/config/cluster-manager.xml (original)
+++ tomcat/trunk/webapps/docs/config/cluster-manager.xml Mon Aug 29 10:30:38
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: [email protected]
For additional commands, e-mail: [email protected]