vy commented on PR #1401: URL: https://github.com/apache/logging-log4j2/pull/1401#issuecomment-1554747497
> If our DI system worked properly I might agree with you. It does not. If so, I think we should pause stacking features on top of it and first fix it. I would appreciate it if you can raise this observation of yours with some more detail in the mailing list. A solution proposal would also come pretty handy. >> I have provided several examples demonstrating why static registries are bad: >> >> Hinders testing > > No they don't. So long as you can register mock objects it makes no difference whether the registry has a static anchor or not. Ralph, I am tired of this. I am trying to be polite, giving you concrete examples, but you are slamming the door with hand waving. Either show me a green CI build with `fork=false, parallel=true` or please stop. >>Do you have a particular use case in mind that requires, e.g., thread inheritance? > >Well of course. I have two. > 1. Scoped Values. "Scoped values are automatically inherited by all child threads created using the StructuredTaskScope." Given that is the default I am sure we will want a way to disable it for certain use cases while leaving it enabled for others. This is a concern of the `ThreadLocalRecycler` implementation, not the use-site. TLR needs to make sure that it doesn't return an already acquired object. As a matter of fact, this is what it does in its current form, since values are provided from a queue stored in a TL. > 1. I am using an InheritableThreadLocal in PropretiesUtil so that when configuration takes place any method called, even on a child thread, will get the correct property sources. I don't see how your `InheritableThreadLocal` usage in `PropretiesUtil` has to anything to do with a recycler. As a matter of fact, the `InheritableThreadLocal` need there arises only because `PropretiesUtil` is accessed statically everywhere, instead of a singleton bean injected by DI. >> Do you have a [non-hypothetical] use case in mind for the recycler sharing you mention? > > ... no I can't firmly give you an example. I will postpone the idea of a recycler registry until a need arises. We can introduce one when needed in a backward compatible way. > I will note that you also didn't address the idea of using a Spec object instead of a simple String that directly names the implementation. I did that on purpose, since I haven't heard a single use-case where it would be necessary. Until I hear one, I am inclined to save it for future. -- 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]
