-
Notifications
You must be signed in to change notification settings - Fork 61
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
allowing configuring shutdown hook #372
Conversation
The shutdown hook is hooked into the JVM and is executed when the JVM stops. This can be beneficial when the application is not managing pi4j's life cycle, but when an application wants to properly manage the life cycle, then this can be detrimental to the shutdown sequence of the application. This change allows such an application to disable this feature. The shutdown hook is still enabled by default, a future version might decide to disable it by default.
@FDelporte should we disable it by default, or leave it enabled as is currently the case? |
Not sure, I started doubting myself based on your remark in the ticket... |
Well in the end, it is quite simple for those who care. Change the following line:
to
or if it was default disabled, they can enable it again:
|
I personally would prefer having it opt-in / disabled by default. |
That calls for some extra documentation ;-) |
Ok, i now disabled the hook by default. After the checks passed, I'll merge, and then think we can do a 2.6.2, or do you think this warrants a 2.7.0? @FDelporte |
I'm a little confused 😄 Which option most closely resembles the existing behaviour? It sounds like this decision could introduce a breaking change for existing users, but maybe I'm misreading this thread |
Yes, this is a breaking change. Existing behaviour can be reactivated with:
We will communicate this in the release notes, when we release. |
The shutdown hook is hooked into the JVM and is executed when the JVM stops.
This can be beneficial when the application is not managing pi4j's life cycle, but when an application wants to properly manage the life cycle, then this can be detrimental to the shutdown sequence of the application.
This change allows such an application to disable this feature.
The shutdown hook is still enabled by default, a future version might decide to disable it by default.