Author: cwiklik
Date: Wed Sep 21 19:27:18 2011
New Revision: 1173802

URL: http://svn.apache.org/viewvc?rev=1173802&view=rev
Log:
UIMA-2231 handle InterruptedException while blocking in sendAndReceive

Modified:
    
uima/uima-as/trunk/uimaj-as-jms/src/main/java/org/apache/uima/adapter/jms/client/BaseUIMAAsynchronousEngineCommon_impl.java

Modified: 
uima/uima-as/trunk/uimaj-as-jms/src/main/java/org/apache/uima/adapter/jms/client/BaseUIMAAsynchronousEngineCommon_impl.java
URL: 
http://svn.apache.org/viewvc/uima/uima-as/trunk/uimaj-as-jms/src/main/java/org/apache/uima/adapter/jms/client/BaseUIMAAsynchronousEngineCommon_impl.java?rev=1173802&r1=1173801&r2=1173802&view=diff
==============================================================================
--- 
uima/uima-as/trunk/uimaj-as-jms/src/main/java/org/apache/uima/adapter/jms/client/BaseUIMAAsynchronousEngineCommon_impl.java
 (original)
+++ 
uima/uima-as/trunk/uimaj-as-jms/src/main/java/org/apache/uima/adapter/jms/client/BaseUIMAAsynchronousEngineCommon_impl.java
 Wed Sep 21 19:27:18 2011
@@ -1859,6 +1859,16 @@ public abstract class BaseUIMAAsynchrono
       try {
         threadMonitor.getMonitor().acquire();
       } catch (InterruptedException e) {
+       if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.INFO)) {
+            UIMAFramework.getLogger(CLASS_NAME).logrb(Level.INFO, 
CLASS_NAME.getName(),
+                    "sendAndReceiveCAS", JmsConstants.JMS_LOG_RESOURCE_BUNDLE,
+                    "UIMAJMS_client_interrupted_INFO", new Object[] { 
casReferenceId, aCAS.hashCode()});
+        }
+       // cancel the timer if it is associated with a CAS this thread is 
waiting for. This would be
+       // the oldest CAS submitted to a queue for processing. The timer will 
be canceled and restarted
+       // for the second oldest CAS in the outstanding list.
+       serviceDelegate.cancelTimerForCasOrPurge(casReferenceId);
+       throw new ResourceProcessException(e);
       }
     }
     try {
@@ -1905,7 +1915,16 @@ public abstract class BaseUIMAAsynchrono
             break; // done here, received a reply or the client is not running
           }
         } catch (InterruptedException e) {
-
+               if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.INFO)) 
{
+                UIMAFramework.getLogger(CLASS_NAME).logrb(Level.INFO, 
CLASS_NAME.getName(),
+                        "sendAndReceiveCAS", 
JmsConstants.JMS_LOG_RESOURCE_BUNDLE,
+                        "UIMAJMS_client_interrupted_INFO", new Object[] { 
casReferenceId, aCAS.hashCode()});
+            }
+               // cancel the timer if it is associated with a CAS this thread 
is waiting for. This would be
+               // the oldest CAS submitted to a queue for processing. The 
timer will be canceled and restarted
+               // for the second oldest CAS in the outstanding list.
+               serviceDelegate.cancelTimerForCasOrPurge(casReferenceId);
+               throw new ResourceProcessException(e);
         } finally {
           threadMonitor.getMonitor().release();
         }


Reply via email to