-
-
Notifications
You must be signed in to change notification settings - Fork 9
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
ScheduledThreadPoolExecutor not closed when using a TimeBasedRotationPolicy #12
Comments
[Darn! I have thought of this while writing the code, but forgot about it along the way.] Closing the I will keep you posted. |
Purposing JUnit 4 to test whether something gets closed at JVM exit or not turned out be more difficult than I was anticipating. Nevertheless, I've pushed my changes |
Hello. Thanks for the quick fix. Yes, I can confirm the issue as fixed as the application is shutdown gracefully. Tested on Windows. Well done! To check if the application is shutdown gracefully in most safe way I think the approach would to execute the sample application as part of CI/CD pipeline with Example:
Thanks for fixing it! |
It took quite a while for me to properly test this. But finally pulled it out. I have just released v0.9.2, should momentarily appear in Maven Central. Thanks so much again. |
Hi.
It's me again :-) . I now realized that the plugin (which is using your library) prevents the main application to be shutdown gracefully.
I digged the code and figured out that the issue happens when using the
DailyRotationPolicy.getInstance()
.The reason is
DailyRotationPolicy
extendsTimeBasedRotationPolicy
which invokes the following line in methodTimeBasedRotationPolicy#start(Rotatable)
However, this executor service is never subject to be closed. To let my application to shutdown correctly, I need to call the following line in my code:
This has been proven as working. But I think the executor service should be closed by your library as it is owned by you. Therefore, I propose to add the line into your
RotatingFileOutputStream#close()
; unless you see a better way how to close the executor service properly:Be aware, this code has not been tested by myself and I do not know if there are not side-effects. I just explained the root cause what is keeping the application running and running and how the potential fix could look like.
Let me know if you need further details. If you prefer a Pull Request just let me know it.
KR, Christoph
The text was updated successfully, but these errors were encountered: