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 2010/02/19 21:23:46 UTC

svn commit: r911965 - /incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/controller/PrimitiveAnalysisEngineController_impl.java

Author: cwiklik
Date: Fri Feb 19 20:23:46 2010
New Revision: 911965

URL: http://svn.apache.org/viewvc?rev=911965&view=rev
Log:
UIMA-1743 Modified initializeAnalysisEngine() to check service status after produceAnalysisEngine() returns. Modified postInitialize() to spin a cleanup thread only if the service is still running.

Modified:
    incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/controller/PrimitiveAnalysisEngineController_impl.java

Modified: incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/controller/PrimitiveAnalysisEngineController_impl.java
URL: http://svn.apache.org/viewvc/incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/controller/PrimitiveAnalysisEngineController_impl.java?rev=911965&r1=911964&r2=911965&view=diff
==============================================================================
--- incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/controller/PrimitiveAnalysisEngineController_impl.java (original)
+++ incubator/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/controller/PrimitiveAnalysisEngineController_impl.java Fri Feb 19 20:23:46 2010
@@ -164,6 +164,13 @@
       // Parse the descriptor in the calling thread.
       rSpecifier = UimaClassFactory.produceResourceSpecifier(super.aeDescriptor);
         AnalysisEngine ae = UIMAFramework.produceAnalysisEngine(rSpecifier, paramsMap);
+        //  Call to produceAnalysisEngine() may take a long time to complete. While this
+        //  method was executing, the service may have been stopped. Before continuing 
+        //  check if the service has been stopped. If so, destroy AE instance and return.
+        if ( isStopped() ) {
+          ae.destroy();
+          return;
+        }
         if (aeInstancePool == null) {
           aeInstancePool = new AnalysisEngineInstancePoolWithThreadAffinity(analysisEnginePoolSize);
         }
@@ -301,8 +308,16 @@
                     "UIMAEE_cas_manager_wrapper_notdefined__CONFIG", new Object[] {});
           }
         }
+        if (!isStopped()){
+          ((BaseAnalysisEngineController) this).startServiceCleanupThread(30000); // sleep for 30 secs
+          if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.INFO)) {
+            UIMAFramework.getLogger(CLASS_NAME).logrb(Level.INFO, CLASS_NAME.getName(), "postInitialize",
+                  UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE, "UIMAEE_initialized_controller__INFO",
+                  new Object[] { getComponentName() });
+          }
+          super.serviceInitialized = true;
+        }
       }
-      ((BaseAnalysisEngineController) this).startServiceCleanupThread(30000); // sleep for 30 secs
     } catch (AsynchAEException e) {
       if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.WARNING)) {
         UIMAFramework.getLogger(CLASS_NAME).logrb(Level.WARNING, CLASS_NAME.getName(),
@@ -327,12 +342,6 @@
       throw new AsynchAEException(e);
     }
 
-    if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.INFO)) {
-      UIMAFramework.getLogger(CLASS_NAME).logrb(Level.INFO, CLASS_NAME.getName(), "postInitialize",
-              UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE, "UIMAEE_initialized_controller__INFO",
-              new Object[] { getComponentName() });
-    }
-    super.serviceInitialized = true;
   }
 
   /**