Repository: incubator-nifi
Updated Branches:
  refs/heads/NIFI-250 ee63a10b8 -> f246565f7


NIFI-368: generate bulletins when there are problems communicating with 
reporting tasks and controller services


Project: http://git-wip-us.apache.org/repos/asf/incubator-nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-nifi/commit/852cc607
Tree: http://git-wip-us.apache.org/repos/asf/incubator-nifi/tree/852cc607
Diff: http://git-wip-us.apache.org/repos/asf/incubator-nifi/diff/852cc607

Branch: refs/heads/NIFI-250
Commit: 852cc607f6fad61178f7c9d3a26807c24eee4e0e
Parents: ee63a10
Author: Mark Payne <[email protected]>
Authored: Thu Feb 19 15:03:54 2015 -0500
Committer: Mark Payne <[email protected]>
Committed: Thu Feb 19 15:03:54 2015 -0500

----------------------------------------------------------------------
 .../scheduling/StandardProcessScheduler.java    | 31 ++++++++++++--------
 1 file changed, 18 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/852cc607/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/scheduling/StandardProcessScheduler.java
----------------------------------------------------------------------
diff --git 
a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/scheduling/StandardProcessScheduler.java
 
b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/scheduling/StandardProcessScheduler.java
index 0e181c5..955f6b1 100644
--- 
a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/scheduling/StandardProcessScheduler.java
+++ 
b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/scheduling/StandardProcessScheduler.java
@@ -49,6 +49,7 @@ import 
org.apache.nifi.controller.service.ControllerServiceState;
 import org.apache.nifi.controller.service.StandardConfigurationContext;
 import org.apache.nifi.encrypt.StringEncryptor;
 import org.apache.nifi.engine.FlowEngine;
+import org.apache.nifi.logging.ComponentLog;
 import org.apache.nifi.logging.ProcessorLog;
 import org.apache.nifi.nar.NarCloseable;
 import org.apache.nifi.processor.SchedulingContext;
@@ -181,16 +182,11 @@ public final class StandardProcessScheduler implements 
ProcessScheduler {
                         }
                         
                         break;
-                    } catch (final InvocationTargetException ite) {
-                        LOG.error("Failed to invoke the On-Scheduled Lifecycle 
methods of {} due to {}; administratively yielding this ReportingTask and will 
attempt to schedule it again after {}",
-                                new Object[]{reportingTask, 
ite.getTargetException(), administrativeYieldDuration});
-                        LOG.error("", ite.getTargetException());
-
-                        try {
-                            Thread.sleep(administrativeYieldMillis);
-                        } catch (final InterruptedException ie) {
-                        }
                     } catch (final Exception e) {
+                        final Throwable cause = (e instanceof 
InvocationTargetException) ? e.getCause() : e;
+                        final ComponentLog componentLog = new 
SimpleProcessLogger(reportingTask.getIdentifier(), reportingTask);
+                        componentLog.error("Failed to invoke @OnEnabled method 
due to {}", cause);
+                        
                         LOG.error("Failed to invoke the On-Scheduled Lifecycle 
methods of {} due to {}; administratively yielding this ReportingTask and will 
attempt to schedule it again after {}",
                                 new Object[]{reportingTask, e.toString(), 
administrativeYieldDuration}, e);
                         try {
@@ -232,7 +228,10 @@ public final class StandardProcessScheduler implements 
ProcessScheduler {
                     }
                 } catch (final Exception e) {
                     final Throwable cause = (e instanceof 
InvocationTargetException) ? e.getCause() : e;
-                    LOG.error("Failed to invoke the @OnConfigured methods of 
{} due to {}; administratively yielding this ReportingTask and will attempt to 
schedule it again after {}",
+                    final ComponentLog componentLog = new 
SimpleProcessLogger(reportingTask.getIdentifier(), reportingTask);
+                    componentLog.error("Failed to invoke @OnUnscheduled method 
due to {}", cause);
+
+                    LOG.error("Failed to invoke the @OnUnscheduled methods of 
{} due to {}; administratively yielding this ReportingTask and will attempt to 
schedule it again after {}",
                             reportingTask, cause.toString(), 
administrativeYieldDuration);
                     LOG.error("", cause);
                     
@@ -624,8 +623,10 @@ public final class StandardProcessScheduler implements 
ProcessScheduler {
                                 return;
                             }
                         } catch (final Exception e) {
-                            // TODO: Generate a bulletin just like in 
startProcessor
                             final Throwable cause = (e instanceof 
InvocationTargetException) ? e.getCause() : e;
+                            
+                            final ComponentLog componentLog = new 
SimpleProcessLogger(service.getIdentifier(), service);
+                            componentLog.error("Failed to invoke @OnEnabled 
method due to {}", cause);
                             LOG.error("Failed to invoke @OnEnabled method of 
{} due to {}", service.getControllerServiceImplementation(), cause.toString());
                             if ( LOG.isDebugEnabled() ) {
                                 LOG.error("", cause);
@@ -637,8 +638,10 @@ public final class StandardProcessScheduler implements 
ProcessScheduler {
                         }
                     }
                 } catch (final Throwable t) {
-                    // TODO: Generate a bulletin just like in startProcessor
                     final Throwable cause = (t instanceof 
InvocationTargetException) ? t.getCause() : t;
+                    final ComponentLog componentLog = new 
SimpleProcessLogger(service.getIdentifier(), service);
+                    componentLog.error("Failed to invoke @OnEnabled method due 
to {}", cause);
+                    
                     LOG.error("Failed to invoke @OnEnabled method on {} due to 
{}", service.getControllerServiceImplementation(), cause.toString());
                     if ( LOG.isDebugEnabled() ) {
                         LOG.error("", cause);
@@ -673,8 +676,10 @@ public final class StandardProcessScheduler implements 
ProcessScheduler {
                             service.setState(ControllerServiceState.DISABLED);
                             return;
                         } catch (final Exception e) {
-                            // TODO: Generate a bulletin just like in 
startProcessor
                             final Throwable cause = (e instanceof 
InvocationTargetException) ? e.getCause() : e;
+                            final ComponentLog componentLog = new 
SimpleProcessLogger(service.getIdentifier(), service);
+                            componentLog.error("Failed to invoke @OnDisabled 
method due to {}", cause);
+                            
                             LOG.error("Failed to invoke @OnDisabled method of 
{} due to {}", service.getControllerServiceImplementation(), cause.toString());
                             if ( LOG.isDebugEnabled() ) {
                                 LOG.error("", cause);

Reply via email to