[jboss-cvs] JBossCache/src/org/jboss/cache ...
Manik Surtani
msurtani at jboss.com
Tue Nov 28 23:43:02 EST 2006
User: msurtani
Date: 06/11/28 23:43:02
Modified: src/org/jboss/cache Tag: Branch_JBossCache_1_4_0
TreeCache.java
Log:
JBCACHE-813
Revision Changes Path
No revision
No revision
1.195.2.24 +35 -14 JBossCache/src/org/jboss/cache/TreeCache.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: TreeCache.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/TreeCache.java,v
retrieving revision 1.195.2.23
retrieving revision 1.195.2.24
diff -u -b -r1.195.2.23 -r1.195.2.24
--- TreeCache.java 13 Nov 2006 08:04:03 -0000 1.195.2.23
+++ TreeCache.java 29 Nov 2006 04:43:02 -0000 1.195.2.24
@@ -99,7 +99,7 @@
* @author <a href="mailto:manik at jboss.org">Manik Surtani (manik at jboss.org)</a>
* @author Brian Stansberry
* @author Daniel Huang (dhuang at jboss.org)
- * @version $Id: TreeCache.java,v 1.195.2.23 2006/11/13 08:04:03 bwang Exp $
+ * @version $Id: TreeCache.java,v 1.195.2.24 2006/11/29 04:43:02 msurtani Exp $
* <p/>
* @see <a href="http://labs.jboss.com/portal/jbosscache/docs">JBossCache doc</a>
*/
@@ -4229,21 +4229,10 @@
log.trace("callRemoteMethods(): valid members are " + validMembers + " method: " + method_call);
// this is a temporary workaround (JBCACHE-813) until AnyCast (JGRP-338) is available.
- if (validMembers.size() == 1)
+ if (useTcpWorkaround())
{
// use a UNICAST
- Address recipient = (Address) validMembers.get(0);
- Object r = null;
- try
- {
- r = disp.callRemoteMethod(recipient, method_call, mode, timeout);
- }
- catch (Throwable throwable)
- {
- throw new Exception(throwable);
- }
- rsps = new RspList();
- rsps.addRsp(recipient, r);
+ rsps = multipleUnicast(validMembers, method_call, mode, timeout);
}
else
{
@@ -4287,6 +4276,38 @@
return retval;
}
+ boolean useTcpWorkaround()
+ {
+ return channel.getProtocolStack().findProtocol("UDP") == null;
+ }
+
+ /**
+ * This is a workaround for JBCACHE-813
+ */
+ private RspList multipleUnicast(List recipients, MethodCall call, int mode, long timeout) throws Exception
+ {
+ if (recipients == null || recipients.isEmpty()) return null;
+
+ Iterator i = recipients.iterator();
+ RspList rsps = new RspList();
+
+ while (i.hasNext())
+ {
+ Address recipient = (Address) i.next();
+ Object r = null;
+ try
+ {
+ r = disp.callRemoteMethod(recipient, call, mode, timeout);
+ }
+ catch (Throwable throwable)
+ {
+ throw new Exception(throwable);
+ }
+ rsps.addRsp(recipient, r);
+ }
+ return rsps;
+ }
+
/**
* @param members
More information about the jboss-cvs-commits
mailing list