WrenSecurity / wrensec-commons

Community fork of ForgeRock Commons, which contains common utility code used by multiple products originally developed by ForgeRock.
http://wrensecurity.org
0 stars 10 forks source link

Fix JsonFileWriter to not block on shutdown when not started. #31

Closed pavelhoral closed 3 years ago

pavelhoral commented 3 years ago

This changes JsonFileWriter to make sure that the scheduler is actually shutdown on shutdown() request. The original implementation relied on the scheduled task (QueueConsumer) to shut down it's own executor service. However that is not that reliable - when the audit handler framework is incorrectly used then start() might not have been called and the QueueConsumer is hence never scheduled.

I came across this issue in Wren:AM - there is probably a second part for this issue (calling stop on non-started audit service), but I wanted to fix it here as well as I guess this component should not block the main thread in any case.