Skip to content
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

Add shutdown hook - via DataSourcePool.builder().shutdownOnJvmExit(true) #90

Merged
merged 2 commits into from
Mar 1, 2024

Conversation

rbygrave
Copy link
Member

@rbygrave rbygrave commented Mar 1, 2024

With shutdownOnJvmExit(true) then a JVM shutdown hook is registered and when the JVM exists then it will run and shutdown the DataSourcePool (unless it has already been shutdown).

 DataSourcePool pool = DataSourcePool.builder()
        .name("test")
        .url("jdbc:h2:mem:test"i)
        .username("sa")
        .password("")
        .shutdownOnJvmExit(true)
        .build();

Note that this PR leaves the default for this to be off by default. This might change to default to on by default.

rPraml and others added 2 commits January 3, 2024 14:16
- Default this to off for now
- Adjust to support DataSourceBuilder (preferred going forward)
- Change to log at INFO for when the hook is run
- Adjust the test to include an already shutdown pool
@rbygrave rbygrave self-assigned this Mar 1, 2024
@rbygrave rbygrave added this to the 8.12 milestone Mar 1, 2024
@rbygrave rbygrave changed the title Add shutdown hook Add shutdown hook - via DataSourcePool.builder().shutdownOnJvmExit(true) Mar 1, 2024
@rbygrave rbygrave merged commit f7d1476 into master Mar 1, 2024
2 checks passed
@rbygrave rbygrave deleted the add-shutdown-hook branch March 1, 2024 22:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants