[
https://issues.apache.org/jira/browse/NIFI-1464?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15193752#comment-15193752
]
ASF GitHub Bot commented on NIFI-1464:
--------------------------------------
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.
> Refactor lifecycle code for Processors and other components
> -----------------------------------------------------------
>
> Key: NIFI-1464
> URL: https://issues.apache.org/jira/browse/NIFI-1464
> Project: Apache NiFi
> Issue Type: Improvement
> Reporter: Oleg Zhurakousky
> Assignee: Oleg Zhurakousky
> Fix For: 0.6.0
>
>
> Similar lifecycle handling improvements that went in as part of the NIFI-1164
> for ControllerServices, could/should be applied to other components (e..g,
> Processors).
> The improvements may also help to address NIFI-78 (may be without killing the
> thread).
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)