org.apache.webbeans.el
Class ELContextStore

java.lang.Object
  extended by org.apache.webbeans.el.ELContextStore

public 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 Summary
 void addDependent(javax.enterprise.inject.spi.Bean<?> bean, Object dependent, javax.enterprise.context.spi.CreationalContext<?> creationalContext)
          Add a @Dependent scoped bean for later use in the same EL.
 void addNormalScoped(String beanName, Object contextualInstance)
          We cache resolved @NormalScoped bean proxies on the same for speeding up EL.
 void destroyDependents()
          This method have to be called after the EL parsing to cleanup the cache for @Dependent scoped beans.
 void destroyELContextStore()
          This needs to be called at the end of each request.
 Object findBeanByName(String name)
           
 BeanManagerImpl getBeanManager()
           
 Object getDependent(javax.enterprise.inject.spi.Bean<?> bean)
           
static ELContextStore getInstance(boolean createIfNotExist)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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(javax.enterprise.inject.spi.Bean<?> bean,
                         Object dependent,
                         javax.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(javax.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 -

getBeanManager

public BeanManagerImpl getBeanManager()
Returns:
BeanManager for this thread

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)



Copyright © 2008-2012 The Apache Software Foundation. All Rights Reserved.