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/07/07 17:08:48 UTC

svn commit: r674517 - in /incubator/uima/sandbox/branches/uima-as-post1st/uimaj-as-activemq/src: main/java/org/apache/uima/adapter/jms/activemq/ test/java/org/apache/uima/ae/multiplier/

Author: eae
Date: Mon Jul  7 08:08:47 2008
New Revision: 674517

URL: http://svn.apache.org/viewvc?rev=674517&view=rev
Log:
UIMA-1091 - Commit JC '03' patches ('02' patches dropped)

Modified:
    incubator/uima/sandbox/branches/uima-as-post1st/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/activemq/JmsInputChannel.java
    incubator/uima/sandbox/branches/uima-as-post1st/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/activemq/JmsOutputChannel.java
    incubator/uima/sandbox/branches/uima-as-post1st/uimaj-as-activemq/src/test/java/org/apache/uima/ae/multiplier/SimpleCasGenerator.java

Modified: incubator/uima/sandbox/branches/uima-as-post1st/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/activemq/JmsInputChannel.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/branches/uima-as-post1st/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/activemq/JmsInputChannel.java?rev=674517&r1=674516&r2=674517&view=diff
==============================================================================
--- incubator/uima/sandbox/branches/uima-as-post1st/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/activemq/JmsInputChannel.java (original)
+++ incubator/uima/sandbox/branches/uima-as-post1st/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/activemq/JmsInputChannel.java Mon Jul  7 08:08:47 2008
@@ -92,6 +92,8 @@
 	
 	private List listenerContainerList = new ArrayList();
 	
+	private Object mux = new Object();
+	
 	public AnalysisEngineController getController()
 	{
 		return controller;
@@ -182,6 +184,13 @@
 	}
 	private boolean isRemoteRequest( Message aMessage ) throws Exception
 	{
+		
+		//	Dont do checkpoints if a message was sent from a Cas Multiplier
+		if ( aMessage.propertyExists(AsynchAEMessage.CasSequence))
+		{
+			return false;
+		}
+
 		Map properties = ((ActiveMQMessage)aMessage).getProperties();
 		if ( properties.containsKey(AsynchAEMessage.MessageType) &&
 			 properties.containsKey(AsynchAEMessage.Command) &&
@@ -192,7 +201,6 @@
 			boolean isRemote = aMessage.getStringProperty(UIMAMessage.ServerURI).startsWith("vm") == false;
 			if ( isRemote && msgType == AsynchAEMessage.Request &&
 					(command == AsynchAEMessage.Process ||
-					 command == AsynchAEMessage.GetMeta ||
 					 command == AsynchAEMessage.CollectionProcessComplete) )
 			{
 				return true;
@@ -475,22 +483,30 @@
 	
 	private boolean isCheckpointWorthy( Message aMessage ) throws Exception
 	{
-		Map properties = ((ActiveMQMessage)aMessage).getProperties();
-		if ( properties.containsKey(AsynchAEMessage.MessageType) &&
-			 properties.containsKey(AsynchAEMessage.Command) &&
-			 properties.containsKey(UIMAMessage.ServerURI))
+		synchronized( mux )
 		{
-			int msgType = aMessage.getIntProperty(AsynchAEMessage.MessageType);
-			int command = aMessage.getIntProperty(AsynchAEMessage.Command);
-			if ( msgType == AsynchAEMessage.Request &&
-					(command == AsynchAEMessage.Process ||
-					 command == AsynchAEMessage.GetMeta ||
-					 command == AsynchAEMessage.CollectionProcessComplete) )
+			//	Dont do checkpoints if a message was sent from a Cas Multiplier
+			if ( aMessage.propertyExists(AsynchAEMessage.CasSequence))
 			{
-				return true;
+				return false;
 			}
+			Map properties = ((ActiveMQMessage)aMessage).getProperties();
+			if ( properties.containsKey(AsynchAEMessage.MessageType) &&
+				 properties.containsKey(AsynchAEMessage.Command) &&
+				 properties.containsKey(UIMAMessage.ServerURI))
+			{
+				int msgType = aMessage.getIntProperty(AsynchAEMessage.MessageType);
+				int command = aMessage.getIntProperty(AsynchAEMessage.Command);
+				if ( msgType == AsynchAEMessage.Request &&
+						(command == AsynchAEMessage.Process ||
+						 command == AsynchAEMessage.CollectionProcessComplete) )
+				{
+					return true;
+				}
+			}
+			return false;
+			
 		}
-		return false;
 	}
 	/**
 	 * Receives Messages from the JMS Provider. It checks the message header
@@ -627,7 +643,7 @@
 					if ( isRemoteRequest( aMessage ))
 					{
 						//	Compute the time between waiting for this request 
-						idleTime = getController().getTotalIdleTime();
+						idleTime = getController().getIdleTime();
 						//	This idle time is reported to the client thus save it in the endpoint
 						//	object. This value will be fetched and added to the outgoing reply.
 						messageContext.getEndpoint().setIdleTime(idleTime);
@@ -666,7 +682,8 @@
 		}
 		finally
 		{
-			if ( doCheckpoint )
+			//	Call the end checkpoint for non-aggregates. For primitives the CAS has been fully processed if we are here
+			if ( doCheckpoint && getController() instanceof PrimitiveAnalysisEngineController )
 			{
 				getController().endProcess(requestType);
 			}

Modified: incubator/uima/sandbox/branches/uima-as-post1st/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/activemq/JmsOutputChannel.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/branches/uima-as-post1st/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/activemq/JmsOutputChannel.java?rev=674517&r1=674516&r2=674517&view=diff
==============================================================================
--- incubator/uima/sandbox/branches/uima-as-post1st/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/activemq/JmsOutputChannel.java (original)
+++ incubator/uima/sandbox/branches/uima-as-post1st/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/activemq/JmsOutputChannel.java Mon Jul  7 08:08:47 2008
@@ -1040,8 +1040,11 @@
 //					aTextMessage.setLongProperty(AsynchAEMessage.TimeWaitingForCAS, entry.getTimeWaitingForCAS());
 				aTextMessage.setLongProperty(AsynchAEMessage.TimeToDeserializeCAS, casStats.getRawCasDeserializationTime());
 				aTextMessage.setLongProperty(AsynchAEMessage.TimeInProcessCAS, casStats.getRawAnalysisTime());
-				aTextMessage.setLongProperty(AsynchAEMessage.IdleTime, anEndpoint.getIdleTime() );
-				
+				//aTextMessage.setLongProperty(AsynchAEMessage.IdleTime, anEndpoint.getIdleTime() );
+				long iT =getAnalysisEngineController().getIdleTimeBetweenProcessCalls(AsynchAEMessage.Process); 
+//				System.out.println("##### Controller:"+getAnalysisEngineController().getComponentName()+" Adding Idle Time To Reply Msg:"+iT);
+				getAnalysisEngineController().resetIdleTimeBetweenProcessCalls();
+				aTextMessage.setLongProperty(AsynchAEMessage.IdleTime, iT );
 				String lookupKey = getAnalysisEngineController().getName();//getInProcessCache().getMessageAccessorByReference(aCasReferenceId).getEndpointName();
 				long arrivalTime = getAnalysisEngineController().getTime( aCasReferenceId, lookupKey); //serviceInputEndpoint);
 				long timeInService = System.nanoTime()-arrivalTime;

Modified: incubator/uima/sandbox/branches/uima-as-post1st/uimaj-as-activemq/src/test/java/org/apache/uima/ae/multiplier/SimpleCasGenerator.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/branches/uima-as-post1st/uimaj-as-activemq/src/test/java/org/apache/uima/ae/multiplier/SimpleCasGenerator.java?rev=674517&r1=674516&r2=674517&view=diff
==============================================================================
--- incubator/uima/sandbox/branches/uima-as-post1st/uimaj-as-activemq/src/test/java/org/apache/uima/ae/multiplier/SimpleCasGenerator.java (original)
+++ incubator/uima/sandbox/branches/uima-as-post1st/uimaj-as-activemq/src/test/java/org/apache/uima/ae/multiplier/SimpleCasGenerator.java Mon Jul  7 08:08:47 2008
@@ -162,7 +162,7 @@
 			cas.setDocumentText(this.mDoc2);
 		}
 */
-		if (docCount ==0 )
+		if (docCount ==0 && UIMAFramework.getLogger().isLoggable(Level.FINE))
 		{
 			System.out.println("Initializing CAS with a Document of Size:"+text.length());
 		}