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/06/30 16:10:53 UTC

svn commit: r789747 - /incubator/uima/sandbox/trunk/uima-as/uimaj-as-core/src/main/java/org/apache/uima/aae/handler/input/ProcessRequestHandler_impl.java

Author: cwiklik
Date: Tue Jun 30 14:10:52 2009
New Revision: 789747

URL: http://svn.apache.org/viewvc?rev=789747&view=rev
Log:
UIMA-1391 Modified handling of stop request

Modified:
    incubator/uima/sandbox/trunk/uima-as/uimaj-as-core/src/main/java/org/apache/uima/aae/handler/input/ProcessRequestHandler_impl.java

Modified: incubator/uima/sandbox/trunk/uima-as/uimaj-as-core/src/main/java/org/apache/uima/aae/handler/input/ProcessRequestHandler_impl.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/uima-as/uimaj-as-core/src/main/java/org/apache/uima/aae/handler/input/ProcessRequestHandler_impl.java?rev=789747&r1=789746&r2=789747&view=diff
==============================================================================
--- incubator/uima/sandbox/trunk/uima-as/uimaj-as-core/src/main/java/org/apache/uima/aae/handler/input/ProcessRequestHandler_impl.java (original)
+++ incubator/uima/sandbox/trunk/uima-as/uimaj-as-core/src/main/java/org/apache/uima/aae/handler/input/ProcessRequestHandler_impl.java Tue Jun 30 14:10:52 2009
@@ -24,6 +24,7 @@
 import org.apache.uima.aae.UimaSerializer;
 import org.apache.uima.aae.InProcessCache.CacheEntry;
 import org.apache.uima.aae.controller.AggregateAnalysisEngineController;
+import org.apache.uima.aae.controller.AggregateAnalysisEngineController_impl;
 import org.apache.uima.aae.controller.Endpoint;
 import org.apache.uima.aae.controller.Endpoint_impl;
 import org.apache.uima.aae.controller.PrimitiveAnalysisEngineController;
@@ -859,7 +860,26 @@
 		try	{
 		  String casReferenceId = aMessageContext.getMessageStringProperty(AsynchAEMessage.CasReference);
 	    System.out.println("###################Controller::"+getController().getComponentName()+" Received <<<STOP>>> Request For CAS:"+casReferenceId);
-			getController().addAbortedCasReferenceId(casReferenceId); 
+	    if ( getController() instanceof PrimitiveAnalysisEngineController ) {
+	      getController().addAbortedCasReferenceId(casReferenceId);
+	    } else if ( getController() instanceof AggregateAnalysisEngineController_impl ) {
+	      try {
+	        CasStateEntry casStateEntry = 
+	          getController().getLocalCache().lookupEntry(casReferenceId);
+	        // Mark the CAS as if it have failed. In this case we dont associate any
+	        // exceptions with this CAS so its really not a failure of a CAS or any
+	        // of its children. We simply use the same logic here as if the CAS failed.
+	        // The Aggregate replyToClient() method will know that this CAS was stopped
+	        // as opposed to failed by the fact that the CAS has no exceptions associated
+	        // with it. In such case the replyToClient() method returns an input CAS as if
+	        // it has been fully processed.
+	        casStateEntry.setFailed();
+	        ((AggregateAnalysisEngineController_impl)getController()).stopCasMultipliers();
+	      } catch (Exception ex) {}  // CAS may have already been deleted
+	      
+	    }
+			
+
 		}
 		catch( Exception e){}
 	}