cloud-sql-jdbc-socket-factory
cloud-sql-jdbc-socket-factory copied to clipboard
Ability to recreate the coreSocketFactory in CoreSocketFactory
Currently, coreSocketFactory is a singleton, and there is no way to recreate it after it has been created.
Needed here: https://github.com/GoogleCloudPlatform/spring-cloud-gcp/issues/982
The change needed for this will probably be somewhat involved as there are a bunch of assumptions in the current code that the CoreSocketFactory stays the same throughout.
@kurtisvg Can you give an example of such an assumption? Thanks!
So looking at the code, it might not be as bad as I thought (I was originally thinking about replacing the Admin API client). I think the biggest problem is making sure the executor is shutdown correctly and that all of the instances in the hashmap are "cleaned up" correctly (and that the hashamp is reset)
We'll obviously need to make sure the method used to reset the instance is synchronized as well, and make sure none of the static methods rely on the codeSocketFactory directly and unsynchronized - they need to be using getInstance (we may have a couple of examples of this already).
We're working through some significant refactoring in the core socket factory right now and will be able to revisit this request. As part of recreating the singleton, we'd be resetting the cached TLS certificates and basically starting again from scratch. Is that the expected behavior @meltsufin?
Yes, having a public API to reset it is the requirement there.
#1604 did not fix the whole issue.