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/06 17:23:58 UTC

svn commit: r801673 - /incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/test/java/org/apache/uima/ee/test/utils/BaseTestSupport.java

Author: cwiklik
Date: Thu Aug  6 15:23:35 2009
New Revision: 801673

URL: http://svn.apache.org/viewvc?rev=801673&view=rev
Log:
UIMA-1437 synchronized onBeforeMessageSend

Modified:
    incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/test/java/org/apache/uima/ee/test/utils/BaseTestSupport.java

Modified: incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/test/java/org/apache/uima/ee/test/utils/BaseTestSupport.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/test/java/org/apache/uima/ee/test/utils/BaseTestSupport.java?rev=801673&r1=801672&r2=801673&view=diff
==============================================================================
--- incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/test/java/org/apache/uima/ee/test/utils/BaseTestSupport.java (original)
+++ incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/test/java/org/apache/uima/ee/test/utils/BaseTestSupport.java Thu Aug  6 15:23:35 2009
@@ -356,11 +356,9 @@
 
   protected void runCrTest(BaseUIMAAsynchronousEngine_impl aUimaEeEngine, int howMany) throws Exception
   {
-    Thread t = null;
     engine = aUimaEeEngine;
-    
     final AtomicBoolean ctrlMonitor = new AtomicBoolean();
-    t = spinMonitorThread(ctrlMonitor, howMany, PROCESS_LATCH);
+    spinMonitorThread(ctrlMonitor, howMany, PROCESS_LATCH);
     aUimaEeEngine.process();
     waitOnMonitor(ctrlMonitor);
   }
@@ -434,6 +432,8 @@
 			{
 				// Wait until the monitor thread(s) start.
 				waitOnMonitor(ctrlMonitor);
+				
+				long startTime = System.currentTimeMillis();
 				if (!isStopped)
 				{
 					// Send an in CAS to the top level service
@@ -443,7 +443,8 @@
 				if (t2 != null)
 				{
 					t2.join();
-
+	        long endTime = System.currentTimeMillis();
+	        System.out.println(">>>> Total Time in Service:" + (endTime-startTime));
 					if (!serviceShutdownException && !isStopped && !unexpectedException)
 					{
 						System.out.println("runTest: Sending CPC");
@@ -574,11 +575,11 @@
 			if (cas == null) {
 			  if (isStopping) {
 			    System.out.println(">> runTest: stopping after sending "+i+" of "+howMany+" CASes");
-			    return;
 			  }
 			  else {
 			    System.out.println(">>>> ERROR! sendCas: "+(i+1)+"-th CAS is null?");
 			  }
+        return;
 			}
 			if ( doubleByteText != null )
 			{
@@ -614,7 +615,7 @@
 	protected class UimaAsTestCallbackListener extends UimaAsBaseCallbackListener {
 	  
 	  private String casSent = null;
-    public void onBeforeMessageSend(UimaASProcessStatus status) {
+    public synchronized void onBeforeMessageSend(UimaASProcessStatus status) {
       casSent = status.getCasReferenceId();
       System.out.println("runTest: Received onBeforeMessageSend() Notification With CAS:"+status.getCasReferenceId());
     }
@@ -653,6 +654,7 @@
           System.out.println("runTest: Received Reply from CAS "+casReferenceId+" (Parent "+parentCasReferenceId
                   +") Containing "+list.size()+" Exception(s)");
         }
+	      
 	      for( int i=0; i < list.size(); i++)
 	      {
 	        Exception e = (Exception)list.get(i);