adutra commented on issue #463: URL: https://github.com/apache/polaris/issues/463#issuecomment-2634783176
A few datapoints: https://quarkus.io/guides/duplicated-context: > When using a traditional, blocking, and synchronous framework, processing of each request is performed in a dedicated thread. So, the same thread is used for the entire processing. [...] When you need to propagate data along the processing [...] you can use ThreadLocals. [...] When using a reactive and asynchronous execution model [...] the same thread can be used to handle multiple concurrent processing. Thus, you cannot use ThreadLocals as the values would be leaked between the various concurrent processing. https://quarkus.io/guides/context-propagation: > Traditional blocking code uses [ThreadLocal](https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/ThreadLocal.html) variables to store contextual objects in order to avoid passing them as parameters everywhere [...] If you write reactive/async code [...] try/finally blocks as well as ThreadLocal variables stop working, because your reactive code gets executed in another thread, after the caller ran its finally block. https://stackoverflow.com/questions/76468966/requestscope-vs-threadlocal-for-mutlti-tenant-in-quarkus-with-mutiny: > Using `@RequestScope` with [Context Propagation](https://quarkus.io/guides/context-propagation) is the way to go. Dealing with ThreadLocal manually is going to be very error prone. -- 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]
