You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by cw...@apache.org on 2009/08/17 21:18:12 UTC

svn commit: r805104 - /incubator/uima/uima-as/trunk/uimaj-as-jms/src/main/java/org/apache/uima/adapter/jms/client/BaseUIMAAsynchronousEngineCommon_impl.java

Author: cwiklik
Date: Mon Aug 17 19:18:12 2009
New Revision: 805104

URL: http://svn.apache.org/viewvc?rev=805104&view=rev
Log:
UIMA-1416 Modified to handle ServiceShutdownException sent by a service

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

Modified: incubator/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/incubator/uima/uima-as/trunk/uimaj-as-jms/src/main/java/org/apache/uima/adapter/jms/client/BaseUIMAAsynchronousEngineCommon_impl.java?rev=805104&r1=805103&r2=805104&view=diff
==============================================================================
--- incubator/uima/uima-as/trunk/uimaj-as-jms/src/main/java/org/apache/uima/adapter/jms/client/BaseUIMAAsynchronousEngineCommon_impl.java (original)
+++ incubator/uima/uima-as/trunk/uimaj-as-jms/src/main/java/org/apache/uima/adapter/jms/client/BaseUIMAAsynchronousEngineCommon_impl.java Mon Aug 17 19:18:12 2009
@@ -1263,7 +1263,8 @@
 	    cachedRequest.setException(exception);
 	    if ( exception instanceof AnalysisEngineProcessException ||
 	         ( exception.getCause() != null && 
-	           exception.getCause() instanceof AnalysisEngineProcessException) ) {
+	           ( exception.getCause() instanceof AnalysisEngineProcessException ||
+	             exception.getCause() instanceof ServiceShutdownException) ) ) {
 	      // Indicate that this is a process exception. 
 	      cachedRequest.setProcessException();
 	    }
@@ -1312,22 +1313,21 @@
       throw e;
     }
     finally {
-      
-      if ( cachedRequest != null ) {
-        if ( cachedRequest.isSynchronousInvocation() && cachedRequest.isProcessException() ) {
-          //  Wake up the send thread that is blocking waiting for a reply. When the thread
-          //  receives the signal, it checks if the reply contains an exception and will 
-          //  not return control back to the client
-          wakeUpSendThread(cachedRequest);
-        }
-        //  Dont release the CAS if the application uses synchronous API
-        if ( !cachedRequest.isSynchronousInvocation() && cachedRequest.getCAS() != null )
-        {
-           cachedRequest.getCAS().release();
+     if ( cachedRequest != null ) {
+          if ( cachedRequest.isSynchronousInvocation() && cachedRequest.isProcessException() ) {
+            //  Wake up the send thread that is blocking waiting for a reply. When the thread
+            //  receives the signal, it checks if the reply contains an exception and will 
+            //  not return control back to the client
+            wakeUpSendThread(cachedRequest);
+          }
+          //  Dont release the CAS if the application uses synchronous API
+          if ( !cachedRequest.isSynchronousInvocation() && cachedRequest.getCAS() != null )
+          {
+             cachedRequest.getCAS().release();
+          }
         }
-      }
-      removeFromCache(casReferenceId);
-      serviceDelegate.removeCasFromOutstandingList(casReferenceId);
+        removeFromCache(casReferenceId);
+        serviceDelegate.removeCasFromOutstandingList(casReferenceId);
     }
 	}
 	private void completeProcessingReply( CAS cas, String casReferenceId, int payload, boolean doNotify, Message message, ClientRequest cachedRequest, ProcessTrace pt  )