org.jboss.weld.context.http.HttpSessionContextImpl is the multithreaded context. Also it uses these classes for internal BeanStore:
org.jboss.weld.context.beanstore.http.LazySessionBeanStore
org.jboss.weld.context.beanstore.http.EagerSessionBeanStore
Under the hood these BeanStore_s use HashMap as storage for beans (AbstractSessionBeanStore -> AttributeBeanStore.beanStore.delegate).
However implementation for retrieving bean from the context does not provide additional synchronization for read operation. See
org.jboss.weld.context.AbstractContext.get(Contextual<T>,CreationalContext<T>) line 90 - not synchronized reading from BeanStore (HashMap):
ContextualInstance<T> beanInstance = beanStore.get(id);
This can cause infinite loop because of concurrent modification for HashMap.
This problem does not affect other multithreaded Context impl in Weld (ApplicationContextImpl and SingletonContextImpl), because they use ConcurrentHashMapBeanStore with ConcurrentHashMap inside (see AbstractSharedContext.beanStore).
|