Add sys property to control how to cleanup context's ThreadLocal (Fixes #424)
As explained in #424 this is added to control how to cleanup the context, but:
- I have no idea if the initial
ThreadLocalhave some initialization lambdas: if yes, thenset(null)andremovewould behave differently because a subsequentgetin the former case would returnnullwhile in the latter will cause the init lambda to be called again - what about
clearedValue? I should set to that value instead ofnull?
https://github.com/Sanne/quarkus/commit/75e2d7e4b22ae72c1fa4f1ae51779488843e0f21 is a PoC branch that show how that can be used
@geoand
I think it makes sense.
This is only for the TL we use to override settings locally. I don't think most people use this API. If you want to clear the TL for libs (CDI, Security, Transaction) you need to do it in the respective ThreadLocalProvider implementations. Of which there are many, honestly I've lost track.
Yeah, we'll have to do the same in the providers we use in Quarkus
I am also wondering whether we should have a way to have Quarkus pass this to CP when it bootstraps it