activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r414823 - /incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/FutureResponse.java
Date Fri, 16 Jun 2006 13:31:53 GMT
Author: jstrachan
Date: Fri Jun 16 06:31:53 2006
New Revision: 414823

URL: http://svn.apache.org/viewvc?rev=414823&view=rev
Log:
added patch to handle timeout exceptions gracefully

Modified:
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/FutureResponse.java

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/FutureResponse.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/FutureResponse.java?rev=414823&r1=414822&r2=414823&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/FutureResponse.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/FutureResponse.java
Fri Jun 16 06:31:53 2006
@@ -20,11 +20,14 @@
 import java.io.InterruptedIOException;
 
 import org.apache.activemq.command.Response;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
 import edu.emory.mathcs.backport.java.util.concurrent.ArrayBlockingQueue;
 import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit;
 
 public class FutureResponse {
+    private static final Log log = LogFactory.getLog(FutureResponse.class);
            
     private final ResponseCallback responseCallback;
     private final ArrayBlockingQueue responseSlot = new ArrayBlockingQueue(1);
@@ -34,10 +37,17 @@
     }
 
     public Response getResult() throws IOException {
-        try {
-            return (Response) responseSlot.take();
-        } catch (InterruptedException e) {
-            throw new InterruptedIOException("Interrupted.");
+        while (true) {
+            try {
+                return (Response) responseSlot.take();
+            }
+            catch (InterruptedException e) {
+                Thread.currentThread().interrupt();
+                if (log.isDebugEnabled()) {
+                    log.debug("Operation interupted: " + e, e);
+                }
+                // throw new InterruptedIOException("Interrupted.");
+            }
         }
     }
     



Mime
View raw message