Skip to content
This repository has been archived by the owner on Dec 13, 2023. It is now read-only.

Ensure that ScheduledExecutorService are cleaned-up on shutdown #243

Merged

Conversation

jcockrill-rq
Copy link
Contributor

Ensure that the ScheduledExecutorService objects used by the Postgres DAOs are correctly cleaned-up on shutdown.

It is generally well-advised to ensure that any ExecutorServices that are created by an application are shutdown properly as the application exits. Otherwise any ExecutorService instances that are left running may stay alive and prevent the JVM from exiting cleanly, requiring a SIGKILL to fully shutdown the process. The Postgres DAO implementations do not do this and this PR addresses that.

Pull Request type

  • Bugfix
  • Feature
  • Refactoring (no functional changes, no api changes)
  • Build related changes (Please run ./gradlew generateLock saveLock to refresh dependencies)
  • WHOSUSING.md
  • Other (please describe):

Changes in this PR

The Postgres implementations of ExecutionDAO, MetadataDAO and QueueDAO are now uniformly retaining references to any ScheduledExecutorServices that they construct and initialize and ensure that those are cleaned up appropriately on shutdown.

The shutdown procedure itself has been modelled on the implementation in com.netflix.conductor.es7.dao.index.ElasticSearchRestDAOV7#shutdownExecutorService.

Alternatives considered

None.

@jcockrill-rq
Copy link
Contributor Author

@v1r3n - thank you for reviewing and approving. Could you please merge as I don't have write access to do so.

@v1r3n v1r3n merged commit 0e1e351 into Netflix:main Aug 23, 2023
@jcockrill-rq jcockrill-rq deleted the postgres-executor-shutdown-handlers branch September 4, 2023 06:35
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants