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

ASF GitHub Bot commented on NIFI-1676:
--------------------------------------

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

    https://github.com/apache/nifi/pull/300#discussion_r57181772
  
    --- Diff: 
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/StandardProcessorNode.java
 ---
    @@ -1117,8 +1117,9 @@ public void verifyCanStart() {
     
         @Override
         public void verifyCanStart(final Set<ControllerServiceNode> 
ignoredReferences) {
    -        if (this.getScheduledState() == ScheduledState.RUNNING) {
    -            throw new IllegalStateException(this + " cannot be started 
because it is already running");
    +        final ScheduledState currentState = getPhysicalScheduledState();
    +        if (currentState != ScheduledState.STOPPED && currentState != 
ScheduledState.DISABLED) {
    --- End diff --
    
    This should be an || (or), correct?


> Processor can be scheduled to start running while it is still in a 'STOPPING' 
> state
> -----------------------------------------------------------------------------------
>
>                 Key: NIFI-1676
>                 URL: https://issues.apache.org/jira/browse/NIFI-1676
>             Project: Apache NiFi
>          Issue Type: Bug
>          Components: Core Framework
>            Reporter: Mark Payne
>            Assignee: Mark Payne
>            Priority: Critical
>             Fix For: 0.6.0
>
>
> After the refactoring of the Processor Lifecycle that happened in 0.6.0, a 
> Processor can be told to start while it is still 'stopping'.
> StandardProcessorNode.verifyCanStart() has the following logic:
> {code}
>         if (this.getScheduledState() == ScheduledState.RUNNING) {
>             throw new IllegalStateException(this + " cannot be started 
> because it is already running");
>         }
> {code}
> However, if the state is 'stopping', it also should not be able to start. 
> This wasn't accounted for originally because there was no 'stopping' state. 
> There was only RUNNING and STOPPED; if not RUNNING, it was assumed to be 
> stopped. However, now that there is a STOPPING state, we should instead 
> verify:
> {code}
>         if (this.getScheduledState() != ScheduledState.STOPPED) {
>             throw new IllegalStateException(this + " cannot be started 
> because it is not completely stopped");
>         }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to