T
- public abstract class ContextualInstanceStrategy<T> extends Object
Context.get(javax.enterprise.context.spi.Contextual)
or Context.get(javax.enterprise.context.spi.Contextual, CreationalContext)
on the given context. This algorithm matches the defaultStrategy()
implementation.
In addition, specialized implementations are provided.
For ApplicationScoped
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 via AlterableContext
and the cached instance is flushed in such case.
For SessionScoped
, ConversationScoped
and RequestScoped
beans a special strategy is used which caches contextual bean instances in
a ThreadLocal
. This implementation respects the possibility of an instance being destroyed via AlterableContext
and the cached instance is
flushed in such case. This is done indirectly by RequestScopedCache
.Modifier and Type | Method and Description |
---|---|
static <T> ContextualInstanceStrategy<T> |
create(BeanAttributes<T> bean,
BeanManagerImpl manager) |
static <T> ContextualInstanceStrategy<T> |
defaultStrategy() |
public static <T> ContextualInstanceStrategy<T> defaultStrategy()
public static <T> ContextualInstanceStrategy<T> create(BeanAttributes<T> bean, BeanManagerImpl manager)
Copyright © 2015. All Rights Reserved.