Search in sources :

Example 1 with ContextNotActiveException

use of org.jboss.weld.context.ContextNotActiveException in project HotswapAgent by HotswapProjects.

the class BeanReloadExecutor method doReloadBeanInBeanContexts.

private static void doReloadBeanInBeanContexts(BeanManagerImpl beanManager, Class<?> beanClass, ManagedBean<?> managedBean) {
    try {
        Map<Class<? extends Annotation>, List<Context>> contexts = getContextMap(beanManager);
        List<Context> ctxList = contexts.get(managedBean.getScope());
        if (ctxList != null) {
            for (Context context : ctxList) {
                doReloadBeanInContext(beanManager, beanClass, managedBean, context);
            }
        } else {
            LOGGER.debug("No active contexts for bean '{}' in scope '{}'", beanClass.getName(), managedBean.getScope());
        }
    } catch (ContextNotActiveException e) {
        LOGGER.warning("No active contexts for bean '{}'", e, beanClass.getName());
    } catch (Exception e) {
        LOGGER.warning("Context for '{}' failed to reload", e, beanClass.getName());
    }
}
Also used : Context(javax.enterprise.context.spi.Context) ContextNotActiveException(org.jboss.weld.context.ContextNotActiveException) List(java.util.List) Annotation(java.lang.annotation.Annotation) ContextNotActiveException(org.jboss.weld.context.ContextNotActiveException)

Aggregations

Annotation (java.lang.annotation.Annotation)1 List (java.util.List)1 Context (javax.enterprise.context.spi.Context)1 ContextNotActiveException (org.jboss.weld.context.ContextNotActiveException)1