-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NIFI-13713 Moving initializtion of NAR Manager to after Jetty start i… #9231
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for addressing this issue @bbende.
On initial review, it seems like it would be worth considering alternative approaches, such as some time of asynchronous loading in Jetty Server itself. Although Jetty Server already retrieves several objects from the Spring Application Context, coupling the initialization of a particular object like the NarManager seems a bit brittle. It may be the best option, but worth evaluating other possibilities for signaling.
@exceptionfactory thanks for the review! I refactored the approach so that the original |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for reworking the approach @bbende, the polling strategy looks good.
On the implementation, what do you think about using a ScheduledExecutorService? With that approach, the thread could continue running on the scheduled interval, the Executor could be initialized earlier, and executor shutdown could be a bit cleaner.
@exceptionfactory I actually implemented that way at first and had it working like that, but then I convinced myself that it wasn't really taking advantage of having a blocking queue and by polling the blocking queue we get almost immediate response when something is submitted, as opposed to waiting til the next time the scheduled task runs. Since the interval was only 5 seconds it doesn't really make a big difference so I can go back to the executor if you think it is cleaner. In that case it doesn't really poll the queue, it just calls drainTo to take everything at the time the task runs. |
Thanks for the reply @bbende, that's a good point about the faster response time in the current approach. That part sounds good. The only other change I would consider then is instantiating the Task in the declaration. That way it will never be |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again for working through the feedback @bbende, the latest version looks good! +1 merging
…s done
Summary
NIFI-13713
Tracking
Please complete the following tracking steps prior to pull request creation.
Issue Tracking
Pull Request Tracking
NIFI-00000
NIFI-00000
Pull Request Formatting
main
branchVerification
Please indicate the verification steps performed prior to pull request creation.
Build
mvn clean install -P contrib-check
Licensing
LICENSE
andNOTICE
filesDocumentation