This content has been marked as final.
Show 1 reply
-
1. Re: CDI custom scope and threadpool
jharting Jan 14, 2015 2:18 AM (in response to swdev)Hi Tony,
if you want the state of your context to be propagated across different threads you need to use a different storage than a ThreadLocal. For example ConcurrentHashMap. Before any piece of code is run on a given thread your code should make sure to associate the thread with the given context (e.g. use a ThreadLocal to make a note that the thread is now using the given map as its backing storage and that instances with a given service key should be used). and dissociate it at the end.