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(javax.enterprise.context.spi.Contextual)orContext.get(javax.enterprise.context.spi.Contextual, CreationalContext)on the given context. This algorithm matches thedefaultStrategy()implementation. In addition, specialized implementations are provided. ForApplicationScopedbeans 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 viaAlterableContextand the cached instance is flushed in such case. ForSessionScoped,ConversationScopedandRequestScopedbeans a special strategy is used which caches contextual bean instances in aThreadLocal. This implementation respects the possibility of an instance being destroyed viaAlterableContextand 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(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(BeanAttributes<T> bean, BeanManagerImpl manager)
-
-