/[Apache-SVN]/tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tipis/RpcChannel.java
ViewVC logotype

Diff of /tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tipis/RpcChannel.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

--- tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tipis/RpcChannel.java	2006/03/07 21:46:32	384023
+++ tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tipis/RpcChannel.java	2006/03/07 21:54:33	384024
@@ -79,11 +79,15 @@ public class RpcChannel implements Chann
         if ( destination==null || destination.length == 0 ) return new Response[0];
         RpcCollectorKey key = new RpcCollectorKey(UUIDGenerator.randomUUID(false));
         RpcCollector collector = new RpcCollector(key,options,destination.length,timeout);
-        synchronized (collector) {
-            responseMap.put(key,collector);
-            RpcMessage rmsg = new RpcMessage(rpcId,key.id,message);
-            channel.send(destination,rmsg);
-            collector.wait(timeout);
+        try {
+            synchronized (collector) {
+                responseMap.put(key, collector);
+                RpcMessage rmsg = new RpcMessage(rpcId, key.id, message);
+                channel.send(destination, rmsg);
+                collector.wait(timeout);
+            }
+        }finally {
+            responseMap.remove(key);
         }
         return collector.getResponses();
     }
@@ -98,8 +102,10 @@ public class RpcChannel implements Chann
                 callback.leftOver(rmsg.message, sender);
             } else {
                 synchronized (collector) {
-                    collector.addResponse(rmsg.message, sender);
-                    if (collector.isComplete()) collector.notifyAll();
+                    if ( responseMap.containsKey(key) ) {
+                        collector.addResponse(rmsg.message, sender);
+                        if (collector.isComplete()) collector.notifyAll();
+                    }
                 }//synchronized
             }//end if
         } else{

 

infrastructure at apache.org
ViewVC Help
Powered by ViewVC 1.1.26