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/09/16 15:44:24 UTC

svn commit: r997750 - /uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/UimaAsThreadFactory.java

Author: cwiklik
Date: Thu Sep 16 13:44:24 2010
New Revision: 997750

URL: http://svn.apache.org/viewvc?rev=997750&view=rev
Log:
UIMA-1872 Modified to log a Throwable that may occur while initializing AE. Also, added code to notify listeners of initialization failure via a callback

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

Modified: uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/UimaAsThreadFactory.java
URL: http://svn.apache.org/viewvc/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/UimaAsThreadFactory.java?rev=997750&r1=997749&r2=997750&view=diff
==============================================================================
--- uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/UimaAsThreadFactory.java (original)
+++ uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/UimaAsThreadFactory.java Thu Sep 16 13:44:24 2010
@@ -24,7 +24,6 @@ import java.util.concurrent.ThreadFactor
 import org.apache.uima.UIMAFramework;
 import org.apache.uima.aae.controller.PrimitiveAnalysisEngineController;
 import org.apache.uima.util.Level;
-import org.springframework.core.task.TaskRejectedException;
 
 /**
  * Custom ThreadFactory for use in the TaskExecutor. The TaskExecutor is plugged in by Spring from
@@ -79,7 +78,19 @@ public class UimaAsThreadFactory impleme
             // Call given Worker (Runnable) run() method and block. This call block until the
             // TaskExecutor is terminated.
             r.run();
-          } catch (Exception e) {
+          } catch (Throwable e) {
+        	  UIMAFramework.getLogger(CLASS_NAME).logrb(Level.WARNING, getClass().getName(),
+                      "UimaAsThreadFactory", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
+                      "UIMAEE_exception__WARNING", e);
+        	  if ( controller != null ) {
+              	  Exception ex;
+              	  if ( e instanceof Exception ) {
+              		  ex = (Exception)e;
+              	  } else {
+              		  ex = new Exception(e);
+              	  }
+            	  controller.notifyListenersWithInitializationStatus(ex);
+        	  } 
             return;
           }
         }
@@ -88,12 +99,12 @@ public class UimaAsThreadFactory impleme
       if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.WARNING)) {
         if ( controller != null ) {
           UIMAFramework.getLogger(CLASS_NAME).logrb(Level.WARNING, CLASS_NAME.getName(),
-                  "CacheEntry", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
+                  "UimaAsThreadFactory", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
                   "UIMAEE_service_exception_WARNING", controller.getComponentName());
         }
 
         UIMAFramework.getLogger(CLASS_NAME).logrb(Level.WARNING, getClass().getName(),
-                "CacheEntry", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
+                "UimaAsThreadFactory", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
                 "UIMAEE_exception__WARNING", e);
       }
     }