[ 
https://issues.apache.org/jira/browse/NIFI-1464?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15193753#comment-15193753
 ] 

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_r56044999
  
    --- Diff: 
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/StandardProcessorNode.java
 ---
    @@ -1382,21 +1372,16 @@ public void run() {
          * be logged (WARN) informing a user so further actions could be taken.
          * </p>
          */
    -    private void invokeTaskAsCancelableFuture(ScheduledExecutorService 
taskScheduler, Callable<Void> task) {
    -        Future<Void> executionResult = taskScheduler.submit(task);
    -
    -        String timeoutString = 
NiFiProperties.getInstance().getProperty(NiFiProperties.PROCESSOR_SCHEDULING_TIMEOUT);
    -        long onScheduleTimeout = timeoutString == null ? Long.MAX_VALUE
    -                : FormatUtils.getTimeDuration(timeoutString.trim(), 
TimeUnit.MILLISECONDS);
    -
    +    private <T> void invokeTaskAsCancelableFuture(SchedulingAgentCallback 
callback, Callable<T> task) {
             try {
    -            executionResult.get(onScheduleTimeout, TimeUnit.MILLISECONDS);
    +            callback.invokeTaskAsCancelableFuture(task);
             } catch (InterruptedException e) {
                 LOG.warn("Thread was interrupted while waiting for processor 
'" + this.processor.getClass().getSimpleName()
                         + "' lifecycle operation (OnScheduled or 
OnUnscheduled) to finish.");
                 Thread.currentThread().interrupt();
    +            throw new RuntimeException("Interrupted while executing one of 
processor's lifecycle tasks (OnScheduled or OnUnscheduled).", e);
             } catch (TimeoutException e) {
    -            executionResult.cancel(true);
    +            //executionResult.cancel(true);
    --- End diff --
    
    If we don't need this line, can we remove it, instead of commenting it out?


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

Reply via email to