Class ELContextStore


  • public final class ELContextStore
    extends Object
    The ELContextStore serves two different purposes
    1. Store Dependent objects of the same invocation. See spec section 6.4.3. Dependent pseudo-scope and Unified EL. This gets cleaned up with destroyDependents() after the whole Expression got scanned.
    2. Store the Contextual Reference for each name per request thread. This is a performance tuning strategy, because creating a NormalScopedBeanInterceptorHandler for each and every EL call is very expensive. This needs to be cleaned up with destroyELContextStore() at the end of each request.
    • Method Detail

      • getInstance

        public static ELContextStore getInstance​(boolean createIfNotExist)
        Parameters:
        createIfNotExist - if false doesn't create a new ELContextStore if none exists
        Returns:
      • findBeanByName

        public Object findBeanByName​(String name)
      • 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 -
      • 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)