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

    https://github.com/apache/nifi/pull/1364#discussion_r101158900
  
    --- Diff: 
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ExecuteStreamCommand.java
 ---
    @@ -287,6 +311,32 @@ protected PropertyDescriptor 
getSupportedDynamicPropertyDescriptor(final String
             .build();
         }
     
    +    @OnScheduled
    +    public void setupExecutor(final ProcessContext context) {
    +        executor = 
Executors.newFixedThreadPool(context.getMaxConcurrentTasks() * 2, new 
ThreadFactory() {
    +            private final ThreadFactory defaultFactory = 
Executors.defaultThreadFactory();
    +
    +            @Override
    +            public Thread newThread(final Runnable r) {
    +                final Thread t = defaultFactory.newThread(r);
    +                t.setName("ExecuteStreamCommand " + getIdentifier() + " 
Task");
    +                return t;
    +            }
    +        });
    +    }
    +
    +    @OnUnscheduled
    --- End diff --
    
    @rkarthik29 
    
    OnUnscheduled runs before all the executing threads are complete, I think 
it would be safer to use OnStopped to shutdown the executor


---
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