fix: all throwables should be ignored in shutdown hook#950
fix: all throwables should be ignored in shutdown hook#950thiagotnunes merged 1 commit intomasterfrom
Conversation
All throwables (and not just exceptions) should be ignored in the shutdown hook. Failing to close these resources during shutdown is not a major problem, as they will be garbage collected by the backend anyways. Without this wide catch, some applications will log a ClassNotFoundException when shutting down, which can be confusing for end users. Fixes #949
Codecov Report
@@ Coverage Diff @@
## master #950 +/- ##
=========================================
Coverage 85.22% 85.22%
- Complexity 2651 2652 +1
=========================================
Files 145 145
Lines 14358 14358
Branches 1391 1391
=========================================
+ Hits 12236 12237 +1
+ Misses 1540 1539 -1
Partials 582 582
Continue to review full report at Codecov.
|
|
Why is the class loader different during initialization vs finalization? |
I'm not sure exactly what happens, but globally speaking it seems to be caused by the fact that the shutdown hook is invoked when Maven is being shutdown, and not when the plugin is shutdown. So my hunch is the following:
Note: This is not a |
|
Thanks for the explanation @olavloite |
All throwables (and not just exceptions) should be ignored in the shutdown hook. Failing to close these resources during shutdown is not a major problem, as they will be garbage collected by the backend anyways. Without this wide catch, some
applications will log a ClassNotFoundException when shutting down, which can be confusing for end users.
Fixes #949
Also fixes cloudspannerecosystem/liquibase-spanner#66 (comment)