You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by ea...@apache.org on 2008/05/02 19:36:41 UTC

svn commit: r652840 - in /incubator/uima/sandbox/trunk/uima-as/uimaj-as-core/src/main/java/org/apache/uima/aae: controller/ error/handler/ handler/input/

Author: eae
Date: Fri May  2 10:36:40 2008
New Revision: 652840

URL: http://svn.apache.org/viewvc?rev=652840&view=rev
Log:
UIMA-786 commit Jerry's "05-02" patches

Modified:
    incubator/uima/sandbox/trunk/uima-as/uimaj-as-core/src/main/java/org/apache/uima/aae/controller/AggregateAnalysisEngineController_impl.java
    incubator/uima/sandbox/trunk/uima-as/uimaj-as-core/src/main/java/org/apache/uima/aae/controller/PrimitiveAnalysisEngineController_impl.java
    incubator/uima/sandbox/trunk/uima-as/uimaj-as-core/src/main/java/org/apache/uima/aae/error/handler/ProcessCasErrorHandler.java
    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/controller/AggregateAnalysisEngineController_impl.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/uima-as/uimaj-as-core/src/main/java/org/apache/uima/aae/controller/AggregateAnalysisEngineController_impl.java?rev=652840&r1=652839&r2=652840&view=diff
==============================================================================
--- incubator/uima/sandbox/trunk/uima-as/uimaj-as-core/src/main/java/org/apache/uima/aae/controller/AggregateAnalysisEngineController_impl.java (original)
+++ incubator/uima/sandbox/trunk/uima-as/uimaj-as-core/src/main/java/org/apache/uima/aae/controller/AggregateAnalysisEngineController_impl.java Fri May  2 10:36:40 2008
@@ -695,7 +695,7 @@
 					// handle the CAS in delegate Aggregate services. When the CAS is processed
 					// in the Delegate Aggregate, the CAS produced in the parent Aggregate cannot
 					// be dropped in the delegate. Check Final Step logic.
-					getInProcessCache().getCacheEntryForCAS(aNewCasReferenceId).setNewCas(true, getName());
+					getInProcessCache().getCacheEntryForCAS(aNewCasReferenceId).setNewCas(true, getComponentName());
 				}
 				else
 				{
@@ -986,24 +986,27 @@
 					}
 				}
 			}
-			else if ( isTopLevelComponent())
+			else //if ( isTopLevelComponent())
 			{
 				//	 This is a subordinate CAS. First get cache entry for the input (parent) CAS
 				parentCASCacheEntry = 
 					getInProcessCache().getCacheEntryForCAS(cacheEntry.getInputCasReferenceId());
-
-				replyWithInputCAS = decrementCasSubordinateCount( parentCASCacheEntry);
-				if ( parentCASCacheEntry != null )
+				if ( getMessageOrigin(aCasReferenceId) == null )
 				{
-					//	Set the flag to indicate that the cache entry for the parent CAS has been updated
-					//	In case an exception happens below, the error handler will be instructed to skip
-					//	decrementing subordinate count (since it's been done already)
-					subordinateCasInPlayCountDecremented = true;
+					replyWithInputCAS = decrementCasSubordinateCount( parentCASCacheEntry);
+					if ( parentCASCacheEntry != null )
+					{
+						//	Set the flag to indicate that the cache entry for the parent CAS has been updated
+						//	In case an exception happens below, the error handler will be instructed to skip
+						//	decrementing subordinate count (since it's been done already)
+						subordinateCasInPlayCountDecremented = true;
+					}
 				}
 				else
 				{
-					//	Input CAS doesnt exist
+					replyWithInputCAS = true;
 				}
+				
 			}
 			
 			// Cas Processing has been completed. Check if the CAS should be sent to
@@ -1015,7 +1018,7 @@
 			// aggregate is not configured to output new CASes
 
 			String casProducer = cacheEntry.getCasProducerAggregateName();
-			boolean isNewCas = (cacheEntry.isNewCas() && casProducer != null && getName().equals(casProducer));
+			boolean isNewCas = (cacheEntry.isNewCas() && casProducer != null && getComponentName().equals(casProducer));
 
 			//	If debug level=FINEST show the size of the cache
 			getInProcessCache().dumpContents();
@@ -1027,7 +1030,7 @@
 					dropCAS(aCasReferenceId, true);
 				}
 				
-				if ( parentCASCacheEntry != null && parentCASCacheEntry.isSubordinate() 
+				if ( parentCASCacheEntry != null //&& parentCASCacheEntry.isSubordinate() 
 					    && parentCASCacheEntry.isReplyReceived()
 					    && parentCASCacheEntry.getState() == CacheEntry.FINAL_STATE
 						&& parentCASCacheEntry.getSubordinateCasInPlayCount() == 0)
@@ -1037,7 +1040,7 @@
 					finalStep(aStep, parentCASCacheEntry.getCasReferenceId());
 				}
 			}
-			
+/*			
 			if ( replyWithInputCAS && parentCASCacheEntry != null )
 			{
 				//	Reply with the input CAS
@@ -1047,7 +1050,12 @@
 			{
 				replyToClient( aCasReferenceId );
 			}
-			
+*/			
+			if ( replyWithInputCAS && getMessageOrigin(aCasReferenceId) != null)
+			{
+				//	Reply with the input CAS
+				replyToClient( aCasReferenceId );
+			}
 			
 			String casMultiplierKey = cacheEntry.getCasMultiplierKey();
 			if ( isNewCas  && casMultiplierKey != null ) //&& cacheEntry.shouldSendRequestToFreeCas())
@@ -1085,6 +1093,7 @@
 			}
 			handleError(map, e);
 		}
+/*
 		finally
 		{
 			if ( aCasReferenceId != null && originMap.containsKey(aCasReferenceId))
@@ -1092,6 +1101,7 @@
 				originMap.remove(aCasReferenceId);
 			}
 		}
+*/		
 	}
 	public boolean decrementCasSubordinateCount( CacheEntry aParentCasCacheEntry )
 	{

Modified: incubator/uima/sandbox/trunk/uima-as/uimaj-as-core/src/main/java/org/apache/uima/aae/controller/PrimitiveAnalysisEngineController_impl.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/uima-as/uimaj-as-core/src/main/java/org/apache/uima/aae/controller/PrimitiveAnalysisEngineController_impl.java?rev=652840&r1=652839&r2=652840&view=diff
==============================================================================
--- incubator/uima/sandbox/trunk/uima-as/uimaj-as-core/src/main/java/org/apache/uima/aae/controller/PrimitiveAnalysisEngineController_impl.java (original)
+++ incubator/uima/sandbox/trunk/uima-as/uimaj-as-core/src/main/java/org/apache/uima/aae/controller/PrimitiveAnalysisEngineController_impl.java Fri May  2 10:36:40 2008
@@ -344,7 +344,7 @@
 			long getNextTime = 0;         // stores time in next();   
 			long timeToProcessCAS = 0;    // stores time in hasNext() and next() for each CAS
 			boolean moreCASesToProcess = true;
-			
+/*			
 			
 			String parentCasReferenceId = null;
 			CacheEntry inputCasCacheEntry = null;
@@ -361,7 +361,7 @@
 				//	and the getCacheEntryForCAS() will throw an exception. Ignore it
 				//	here, we are shutting down.
 			}
-
+*/
 			while (moreCASesToProcess)
 			{
 				hasNextTime = System.nanoTime();
@@ -415,6 +415,7 @@
 				sequence++;
 				newCasReferenceId = getInProcessCache().register( casProduced, mContext, otsd);
 				CacheEntry newEntry = getInProcessCache().getCacheEntryForCAS(newCasReferenceId);
+/*
 				if ( parentCasReferenceId == null )
 				{
 					newEntry.setInputCasReferenceId(aCasReferenceId);
@@ -423,6 +424,8 @@
 				{
 					newEntry.setInputCasReferenceId(parentCasReferenceId);
 				}
+*/
+				newEntry.setInputCasReferenceId(aCasReferenceId);
 				//	Add to the cache how long it took to process the generated (subordinate) CAS
 				getCasStatistics(newCasReferenceId).incrementAnalysisTime(timeToProcessCAS);
 				UIMAFramework.getLogger(CLASS_NAME).logrb(Level.FINE, getClass().getName(), "process", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE, "UIMAEE_produced_new_cas__FINE", new Object[] { Thread.currentThread().getName(),getComponentName(),newCasReferenceId, aCasReferenceId });
@@ -446,7 +449,7 @@
 				//	Increment how long it took to process the input CAS. This timer is exposed via JMX
 				statistic.increment(totalProcessTime);
 			}
-			
+/*			
 			if (newCasReferenceId != null)
 			{
 				UIMAFramework.getLogger(CLASS_NAME).logrb(Level.FINEST, getClass().getName(), "process", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE, "UIMAEE_completed_analysis__FINEST", new Object[] { Thread.currentThread().getName(), getComponentName(), newCasReferenceId, (double) (System.nanoTime() - time) / (double) 1000000 });
@@ -456,6 +459,8 @@
 				UIMAFramework.getLogger(CLASS_NAME).logrb(Level.FINEST, getClass().getName(), "process", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE, "UIMAEE_completed_analysis__FINEST", new Object[] { Thread.currentThread().getName(), getComponentName(), aCasReferenceId, (double) (System.nanoTime() - time) / (double) 1000000 });
 
 			}
+*/
+			UIMAFramework.getLogger(CLASS_NAME).logrb(Level.FINEST, getClass().getName(), "process", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE, "UIMAEE_completed_analysis__FINEST", new Object[] { Thread.currentThread().getName(), getComponentName(), aCasReferenceId, (double) (System.nanoTime() - time) / (double) 1000000 });
 			getMonitor().resetCountingStatistic("", Monitor.ProcessErrorCount);
 			getCasStatistics(aCasReferenceId).incrementAnalysisTime(totalProcessTime);
 			//	Aggregate total time spent processing the input CAS

Modified: incubator/uima/sandbox/trunk/uima-as/uimaj-as-core/src/main/java/org/apache/uima/aae/error/handler/ProcessCasErrorHandler.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/uima-as/uimaj-as-core/src/main/java/org/apache/uima/aae/error/handler/ProcessCasErrorHandler.java?rev=652840&r1=652839&r2=652840&view=diff
==============================================================================
--- incubator/uima/sandbox/trunk/uima-as/uimaj-as-core/src/main/java/org/apache/uima/aae/error/handler/ProcessCasErrorHandler.java (original)
+++ incubator/uima/sandbox/trunk/uima-as/uimaj-as-core/src/main/java/org/apache/uima/aae/error/handler/ProcessCasErrorHandler.java Fri May  2 10:36:40 2008
@@ -397,7 +397,6 @@
 								if ( parentCasCacheEntry.getSubordinateCasInPlayCount() == 0 &&
 									 parentCasCacheEntry.isPendingReply())
 								{
-									System.out.println("!!!!!!!!! ProcessCasErrorHandler: Controller:"+aController.getComponentName()+" Parent CAS has NO Subordinates.");
 									//	Complete processing of the Input CAS
 									if ( flowControllerContinueFlag ==  false )
 									{
@@ -431,6 +430,7 @@
 				try
 				{
 					sendExceptionToClient( t, casReferenceId, endpoint, aController );
+					//System.out.println("---------------------------- CAS Produced By CM:"+cacheEntry.getCasProducerKey());
 				}
 				catch( Exception e) 
 				{

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=652840&r1=652839&r2=652840&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 Fri May  2 10:36:40 2008
@@ -230,13 +230,14 @@
 				else
 				{
 					getController().getInProcessCache().register(cas, aMessageContext, deserSharedData, casReferenceId);
+/*
 					if ( aMessageContext.propertyExists(AsynchAEMessage.InputCasReference))
 					{
 						CacheEntry cacheEntry = getController().getInProcessCache().getCacheEntryForCAS(casReferenceId);
 						String parentCasId = aMessageContext.getMessageStringProperty(AsynchAEMessage.InputCasReference);
 						cacheEntry.setInputCasReferenceId(parentCasId);
 					}
-					
+*/					
 					casStats = getController().getCasStatistics(casReferenceId);
 				}
 				casStats.incrementCasDeserializationTime(timeToDeserializeCAS);
@@ -492,10 +493,6 @@
 
 			}
 //			Endpoint replyToEndpoint = aMessageContext.getEndpoint(); 
-			if ( getController() instanceof AggregateAnalysisEngineController )
-			{
-				((AggregateAnalysisEngineController)getController()).addMessageOrigin(casReferenceId, aMessageContext.getEndpoint());
-			}
 			
 			//	This is only used when handling CASes produced by CAS Multiplier
 			String inputCasReferenceId = null;
@@ -552,7 +549,14 @@
 
 				inputCasReferenceId = aMessageContext.getMessageStringProperty(AsynchAEMessage.InputCasReference);
 			}
-			
+			else
+			{
+				if ( getController() instanceof AggregateAnalysisEngineController )
+				{
+					((AggregateAnalysisEngineController)getController()).addMessageOrigin(casReferenceId, aMessageContext.getEndpoint());
+				}
+
+			}
 			cas = getController().getInProcessCache().getCasByReference(casReferenceId);
 			
 			long arrivalTime = System.nanoTime();