-
Notifications
You must be signed in to change notification settings - Fork 38.4k
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
[CRaC] DefaultLifecycleProcessor and stopping beans on first refresh #34510
Comments
Generally, This is also the pattern followed for an onRefresh checkpoint: We aim to not even start the components there yet, in order to avoid the need for explicit stopping to begin with. Only for later checkpoints at runtime, there is an actual need to stop components. For core framework components, we explicitly have all such activity in |
@jhoeller Thanks for those answers! The symmetry makes sense - could you make any suggestion for integration of components that don't have a proper lifecycle and do startup as part of bean instantiation? I've checked Cassandra code and the I've placed a few breakpoints into the starting application and it seems that I've implemented the lifecycle with |
@rvansa Is the |
Hi,
I started hacking a solution that would close Cassandra connections on checkpoint, following [1] and registering a
Lifecycle
that would let the Cassandra session 'suspend'. The checkpoint and restore works in my prototype when I issue the checkpoint viajcmd <pid> JDK.checkpoint
, but if I try automatic checkpoint through-Dspring.context.checkpoint=onRefresh
theLifecycle.stop()
is not called: at this pointDefaultLifecycleProcessor.running
is false andstopForRestart()
is not invoked.I would like to ask what's the reason and if there's any better pattern; [2] explains that the connections are established too early (before first refresh). Is that a show-stopper? We can close those connections and keep going.
An alternative solution would be to not use the
Lifecycle
and register as aorg.crac.Resource
; however I understand that it's preferred to integrate the handling into Spring using that rather than directly.CC @sdeleuze
[1] https://github.com/spring-projects/spring-boot/blob/main/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceCheckpointRestoreConfiguration.java
[2] spring-projects/spring-data-cassandra#1486
The text was updated successfully, but these errors were encountered: