Package org.jboss.weld.bean
Class ContextualInstanceStrategy<T>
- java.lang.Object
-
- org.jboss.weld.bean.ContextualInstanceStrategy<T>
-
- Type Parameters:
T
-
public abstract class ContextualInstanceStrategy<T> extends Object
This component allows optimized strategies for obtaining contextual instances of a given bean to be plugged in. By default a contextual instance of a bean is obtained by first obtaining the context for bean's scope and then by callingContext.get(jakarta.enterprise.context.spi.Contextual)
orContext.get(jakarta.enterprise.context.spi.Contextual, CreationalContext)
on the given context. This algorithm matches thedefaultStrategy()
implementation. In addition, specialized implementations are provided. ForApplicationScoped
beans a special strategy is used which caches application-scoped bean instances in a volatile field. This implementation respects the possibility of an instance being destroyed viaAlterableContext
and the cached instance is flushed in such case. ForSessionScoped
,ConversationScoped
andRequestScoped
beans a special strategy is used which caches contextual bean instances in aThreadLocal
. This implementation respects the possibility of an instance being destroyed viaAlterableContext
and the cached instance is flushed in such case. This is done indirectly byRequestScopedCache
.- Author:
- Jozef Hartinger
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> ContextualInstanceStrategy<T>
create(jakarta.enterprise.inject.spi.BeanAttributes<T> bean, BeanManagerImpl manager)
static <T> ContextualInstanceStrategy<T>
defaultStrategy()
-
-
-
Method Detail
-
defaultStrategy
public static <T> ContextualInstanceStrategy<T> defaultStrategy()
-
create
public static <T> ContextualInstanceStrategy<T> create(jakarta.enterprise.inject.spi.BeanAttributes<T> bean, BeanManagerImpl manager)
-
-