3 ms·
I still don't understand what's the correct way to replace thread locals holding initialization heavy & non thread-safe instances besides using a pool which pro
by Traubenfuchs 4y ago
I still don't understand what's the correct way to replace thread locals holding initialization heavy & non thread-safe instances besides using a pool which produces a lot of overhead when using loom/virtual threads. In the past, with ThreadLocal, you'd have one instance per thread, making sure that those instances could only be used once and would only be instantiated for all threads of your (acceptor) thread pool
Does anyone know the solution?
- Holo314 4y agoVirtual threads are designed for light, IO-bound, tasks, if your task is heavy/CPU-bound tasks then you won't necessarily want to switch to virtual threads with ScopedValue.