Package org.apache.webbeans.el
Class ELContextStore
- java.lang.Object
-
- org.apache.webbeans.el.ELContextStore
-
public final class ELContextStore extends Object
The ELContextStore serves two different purposes-
Store
Dependentobjects of the same invocation. See spec section 6.4.3. Dependent pseudo-scope and Unified EL. This gets cleaned up withdestroyDependents()after the whole Expression got scanned. -
Store the Contextual Reference for each name per request thread. This is a performance
tuning strategy, because creating a
NormalScopedBeanInterceptorHandlerfor each and every EL call is very expensive. This needs to be cleaned up withdestroyELContextStore()at the end of each request.
-
Store
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddDependent(jakarta.enterprise.inject.spi.Bean<?> bean, Object dependent, jakarta.enterprise.context.spi.CreationalContext<?> creationalContext)Add a @Dependent scoped bean for later use in the same EL.voidaddNormalScoped(String beanName, Object contextualInstance)We cache resolved @NormalScoped bean proxies on the same for speeding up EL.voiddestroyDependents()This method have to be called after the EL parsing to cleanup the cache for @Dependent scoped beans.voiddestroyELContextStore()This needs to be called at the end of each request.ObjectfindBeanByName(String name)ObjectgetDependent(jakarta.enterprise.inject.spi.Bean<?> bean)static ELContextStoregetInstance(boolean createIfNotExist)
-
-
-
Method Detail
-
getInstance
public static ELContextStore getInstance(boolean createIfNotExist)
- Parameters:
createIfNotExist- iffalsedoesn't create a new ELContextStore if none exists- Returns:
-
addDependent
public void addDependent(jakarta.enterprise.inject.spi.Bean<?> bean, Object dependent, jakarta.enterprise.context.spi.CreationalContext<?> creationalContext)Add a @Dependent scoped bean for later use in the same EL. See spec section 6.4.3. Dependent pseudo-scope and Unified EL.- Parameters:
bean-dependent-creationalContext-
-
getDependent
public Object getDependent(jakarta.enterprise.inject.spi.Bean<?> bean)
- Parameters:
bean-- Returns:
- the previously used dependent bean or
null - See Also:
addDependent(Bean, Object, CreationalContext)
-
addNormalScoped
public void addNormalScoped(String beanName, Object contextualInstance)
We cache resolved @NormalScoped bean proxies on the same for speeding up EL.- Parameters:
beanName-
-
destroyDependents
public void destroyDependents()
This method have to be called after the EL parsing to cleanup the cache for @Dependent scoped beans.
-
destroyELContextStore
public void destroyELContextStore()
This needs to be called at the end of each request. Because after the request ends, a server might reuse the Thread to serve other requests (from other WebApps)
-
-