Re:Java 20 / JDK 20: General Availability
by Traubenfuchs on Tuesday March 21, 2023 @11:46AM
(#35247872)
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
Re:Java 20 / JDK 20: General Availability
by Holo314 on Tuesday March 21, 2023 @07:16PM
(#35254154)
Virtual 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.
Does anyone know the solution?