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/12 19:25:01 UTC

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

Author: cwiklik
Date: Wed Aug 12 17:25:01 2009
New Revision: 803614

URL: http://svn.apache.org/viewvc?rev=803614&view=rev
Log:
UIMA-1477 Modified handleCollectionProcessCompleteReply() to always release cpcReplySemaphore.

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=803614&r1=803613&r2=803614&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 Wed Aug 12 17:25:01 2009
@@ -823,27 +823,31 @@
 	protected void handleCollectionProcessCompleteReply(Message message) throws Exception
 	{
 		int payload = ((Integer) message.getIntProperty(AsynchAEMessage.Payload)).intValue();
+		try {
+	    if (AsynchAEMessage.Exception == payload)
+	    {
+	      ProcessTrace pt = new ProcessTrace_impl();
+	      UimaASProcessStatusImpl status = new UimaASProcessStatusImpl(pt);
+	      Exception exception = retrieveExceptionFromMessage(message);
 
-		if (AsynchAEMessage.Exception == payload)
-		{
-			ProcessTrace pt = new ProcessTrace_impl();
-			UimaASProcessStatusImpl status = new UimaASProcessStatusImpl(pt);
-			Exception exception = retrieveExceptionFromMessage(message);
-
-			status.addEventStatus("CpC", "Failed", exception);
-			notifyListeners(null, status, AsynchAEMessage.CollectionProcessComplete);
-      if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.FINEST)) {
-        UIMAFramework.getLogger(CLASS_NAME).logrb(Level.FINEST, CLASS_NAME.getName(), "handleCollectionProcessCompleteReply", JmsConstants.JMS_LOG_RESOURCE_BUNDLE, "UIMAJMS_received_exception_msg_INFO",
-					new Object[] { message.getStringProperty(AsynchAEMessage.MessageFrom), message.getStringProperty(AsynchAEMessage.CasReference), exception });
-      }
-		}
-		else
-		{
-		  //  After receiving CPC reply there may be cleanup to do. Delegate this
-		  //  to platform specific implementation (ActiveMQ or WAS)
-			cleanup(); //Make the receiving thread to complete
-			// Release the semaphore acquired in collectionProcessingComplete()
-			cpcReplySemaphore.release();
+	      status.addEventStatus("CpC", "Failed", exception);
+	      notifyListeners(null, status, AsynchAEMessage.CollectionProcessComplete);
+	      if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.INFO)) {
+	        UIMAFramework.getLogger(CLASS_NAME).logrb(Level.INFO, CLASS_NAME.getName(), "handleCollectionProcessCompleteReply", JmsConstants.JMS_LOG_RESOURCE_BUNDLE, "UIMAJMS_received_exception_msg_INFO",
+	          new Object[] { message.getStringProperty(AsynchAEMessage.MessageFrom), message.getStringProperty(AsynchAEMessage.CasReference), exception });
+	      }
+	    }
+	    else
+	    {
+	      //  After receiving CPC reply there may be cleanup to do. Delegate this
+	      //  to platform specific implementation (ActiveMQ or WAS)
+	      cleanup(); 
+	    }
+		} catch( Exception e ) {
+		  throw e;
+		} finally {
+	    // Release the semaphore acquired in collectionProcessingComplete()
+	    cpcReplySemaphore.release();
 		}
 	}