Github user markap14 commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/275#discussion_r56044931
  
    --- Diff: 
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/StandardProcessorNode.java
 ---
    @@ -1314,15 +1312,7 @@ public Void call() throws Exception {
         public <T extends ProcessContext & ControllerServiceLookup> void 
stop(final ScheduledExecutorService scheduler,
                 final T processContext, final Callable<Boolean> 
activeThreadMonitorCallback) {
             if (this.scheduledState.compareAndSet(ScheduledState.RUNNING, 
ScheduledState.STOPPING)) { // will ensure that the Processor represented by 
this node can only be stopped once
    -            invokeTaskAsCancelableFuture(scheduler, new Callable<Void>() {
    -                @Override
    -                public Void call() throws Exception {
    -                    try (final NarCloseable nc = 
NarCloseable.withNarLoader()) {
    -                        
ReflectionUtils.quietlyInvokeMethodsWithAnnotation(OnUnscheduled.class, 
processor, processContext);
    -                        return null;
    -                    }
    -                }
    -            });
    +            
ReflectionUtils.quietlyInvokeMethodsWithAnnotation(OnUnscheduled.class, 
processor, processContext);
    --- End diff --
    
    This call is delegating to Processor code synchronously. Shouldn't we move 
this line into the Runnable below, making this the first line of the Runnable? 
This way, this will happen in the background thread and then the @OnStopped 
method would be called.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to