allthingssecurity commented on PR #30463: URL: https://github.com/apache/camel/pull/30463#issuecomment-7033421719
Thanks, fixed here as you suggested (1b116978360e). - [Important] `CassandraEndpoint` now has a `createdSession` flag. It closes only a session it created from `hosts`, and on stop it sets that session back to null, so the next start builds a new one. A session given with `session` or looked up with `beanRef` is held as managed outside and is never closed by the endpoint. `doStop` also checks for a null holder (a start that failed before the holder was made), and `CassandraSessionHolder.stop()` does nothing on a second call, so a failed restart does not hit a null session. New tests in `CassandraRepositoriesSessionTest`: an endpoint given a session, stopped and started again, does not close it; the same for `cql:bean:mySession`; and a `hosts` endpoint started, stopped and started again gets a new session from the builder, closing each one on its stop. On the previous head all three fail, with the change they pass. Upgrade guide: one more paragraph for the endpoint (it no longer closes a session given with `session` or `beanRef`, an d the application closes such a session itself), and the heading now names the cql endpoint too. - [Nit] The 1-arg constructor has Javadoc now (the session is managed outside, `stop()` does not close it, use the 2-arg constructor with `false` for a session that `stop()` closes). The upgrade guide names `org.apache.camel.utils.cassandra.CassandraSessionHolder` and says the same. I grepped the repo for the holder constructors: the three repositories (and the `Named*` subclasses through `super(session)`) use the 1-arg one for a session they are given, and the endpoint is the only user of the 2-arg one. Tests: camel-cassandraql unit tests 15 run, 0 failures; `CassandraRepositoriesSessionTest` 20 times in one JVM, 140 run, 0 failures. _Claude Code on behalf of allthingssecurity_ -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
