Package org.apache.myfaces.cdi.util
Class ContextualStorage
java.lang.Object
org.apache.myfaces.cdi.util.ContextualStorage
- All Implemented Interfaces:
Serializable
This Storage holds all information needed for storing Contextual Instances in a Context.
It also addresses Serialisation in case of passivating scopes.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected boolean
protected jakarta.enterprise.inject.spi.BeanManager
protected boolean
protected Map<Object,
ContextualInstanceInfo<?>> protected boolean
-
Constructor Summary
ConstructorsConstructorDescriptionContextualStorage
(jakarta.enterprise.inject.spi.BeanManager beanManager, boolean concurrent, boolean passivating) -
Method Summary
Modifier and TypeMethodDescriptionvoid
activate()
void
clear()
<T> T
createContextualInstance
(jakarta.enterprise.context.spi.Contextual<T> bean, jakarta.enterprise.context.spi.CreationalContext<T> creationalContext) void
jakarta.enterprise.context.spi.Contextual<?>
Restores the bean from its beanKey.<T> Object
getBeanKey
(jakarta.enterprise.context.spi.Contextual<T> bean) If the context is a passivating scope then we return the passivationId of the bean.boolean
boolean
-
Field Details
-
contextualInstances
-
beanNameToKeyMapping
-
beanManager
protected jakarta.enterprise.inject.spi.BeanManager beanManager -
concurrent
protected boolean concurrent -
passivating
protected boolean passivating -
activated
protected transient volatile boolean activated
-
-
Constructor Details
-
ContextualStorage
public ContextualStorage() -
ContextualStorage
public ContextualStorage(jakarta.enterprise.inject.spi.BeanManager beanManager, boolean concurrent, boolean passivating) - Parameters:
beanManager
- is needed for serialisationconcurrent
- whether the ContextualStorage might get accessed concurrently by different threadspassivating
- whether the served scope is a passivating scope
-
-
Method Details
-
getStorage
- Returns:
- the underlying storage map.
-
clear
public void clear() -
isConcurrent
public boolean isConcurrent()- Returns:
- whether the ContextualStorage might get accessed concurrently by different threads.
-
createContextualInstance
public <T> T createContextualInstance(jakarta.enterprise.context.spi.Contextual<T> bean, jakarta.enterprise.context.spi.CreationalContext<T> creationalContext) - Type Parameters:
T
-- Parameters:
bean
-creationalContext
-- Returns:
-
getBeanKey
If the context is a passivating scope then we return the passivationId of the bean. Otherwise we use the bean directly, this is mainly for Quarkus.- Parameters:
bean
-- Returns:
- the key to use in the context map
-
getBean
Restores the bean from its beanKey. It returns null if the beanKey does not belong to a bean or is not Contextual. -
isActivated
public boolean isActivated() -
activate
public void activate() -
deactivate
public void deactivate() -
getBeanNameToKeyMapping
-