You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by "Joseph Witt (JIRA)" <ji...@apache.org> on 2016/04/14 02:41:25 UTC

[jira] [Commented] (NIFI-1766) AbstractPutEventProcessor - the sender pool object and sender objects are recreated before and after every call to OnTrigger() respectively.

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

Joseph Witt commented on NIFI-1766:
-----------------------------------

[~aviewfromspace1@gmail.com] The @OnScheduled annotation as described in the javadocs [1] does have wording that I think could lead to the confusion you're describing.  When it says "This will be called before any call to 'onTrigger'" that is just saying you can safely know that if your onTrigger method is called that this OnScheduled method would have already been called.  Further it describes that the annotated method  "will be called once each time a Processor or Reporting Task is scheduled to run".  That is probably the easier to read part.  It is also described in the developer guide and that one is a bit more clear [2].

The same is true of OnStopped.  That just means you can be sure that will be called whenever the processor is told to stop and is in verified to have no more scheduled threads.

In short I believe the processor was already implemented correctly to create the connection once scheduled to run and tear them down once no longer scheduled to run.  Are you seeing poor behavior that you wanted to overcome or were you just looking through the code and identifying a possible improvement?

If this helps clear things up do you mind if I close this ticket?

[1] https://github.com/apache/nifi/blob/0.x/nifi-api/src/main/java/org/apache/nifi/annotation/lifecycle/OnScheduled.java#L27-L36
[2] https://nifi.apache.org/docs/nifi-docs/html/developer-guide.html#onscheduled

> AbstractPutEventProcessor - the sender pool object and sender objects are recreated before and after every call to OnTrigger() respectively.
> --------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: NIFI-1766
>                 URL: https://issues.apache.org/jira/browse/NIFI-1766
>             Project: Apache NiFi
>          Issue Type: Bug
>          Components: Core Framework
>    Affects Versions: 0.6.0
>            Reporter: Matt Brown
>            Priority: Minor
>         Attachments: 0001-NIFI-1766.patch
>
>
> AbstractPutEventProcessor creates the sender pool list object in the OnScheduled() method which is annotated with @OnScheduled. This method therefore gets called before every OnTrigger() call. The sender pool is therefore being recreated for every single FlowFile that is handled by OnTrigger(). Is this the correct behaviour? I was expecting the pool to be created once for the lifetime of the Processor instance.
> Similarly, the sender objects within the sender pool are being closed down by the closeSenders() method which is annotated with @OnStopped. This method therefore gets called after each OnTrigger() call has completed. The senders are therefore being deleted after every OnTrigger() call (and then recreated in the next OnTrigger() call). Is this the intended behaviour? For TCP senders, this means that each FlowFIle is sent over a new TCP connection. I was expecting all FlowFiles to be sent out over the same TCP connection.



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