Examples of BeanStore


Examples of org.gatein.cdi.contexts.beanstore.BeanStore

    public <T> T get(Contextual<T> contextual, CreationalContext<T> creationalContext) {
        if (!isActive()) {
            throw new ContextNotActiveException();
        }

        BeanStore beanStore = getBeanStore();
        if (beanStore == null) {
            return null;
        }

        String id = getId(contextual);
        BeanStoreInstance<T> beanInstance = beanStore.getBean(id);
        if (beanInstance != null) {
            return beanInstance.getInstance();
        } else if (creationalContext != null) {
            LockedBean lock = null;
            try {
                if (multithreaded) {
                    lock = beanStore.lock(id);
                    beanInstance = beanStore.getBean(id);
                    if (beanInstance != null) {
                        return beanInstance.getInstance();
                    }
                }

                T instance = contextual.create(creationalContext);
                if (instance != null) {
                    beanInstance = new SerializableBeanStoreInstance<T>(contextual, instance, creationalContext);
                    beanStore.put(id, beanInstance);
                }
                return instance;
            } finally {
                if (lock != null) {
                    lock.unlock();
View Full Code Here

Examples of org.gatein.cdi.contexts.beanstore.BeanStore

        }
    }

    protected void destroy(String windowId) {
        try {
            BeanStore store = getBeanStore();
            if (store != null) {
                store.destroy(windowId);
            }
        } finally {
            Map<String, PortletRequestLifecycle> map = lifecycles.get();
            if (map != null) {
                map.remove(windowId);
View Full Code Here

Examples of org.gatein.cdi.contexts.beanstore.BeanStore

        }
    }

    protected void destroy() {
        try {
            BeanStore store = getBeanStore();
            if (store != null) {
                store.destroy();
            }
        } finally {
            cleanup();
        }
    }
View Full Code Here

Examples of org.jboss.webbeans.context.api.BeanStore

        wbListener.contextInitialized(new ServletContextEvent(sc));
    }

    @BeforeMethod
    public void beforeMethod() {
        BeanStore reqBS = new ConcurrentHashMapBeanStore();
        RequestContext.instance().setBeanStore(reqBS);
        RequestContext.instance().setActive(true);
        BeanStore sessBS = new ConcurrentHashMapBeanStore();
        SessionContext.instance().setBeanStore(sessBS);
        SessionContext.instance().setActive(true);
    }
View Full Code Here

Examples of org.jboss.weld.context.api.BeanStore

  }
 
  protected BeanStore getBeanStore() {
    final Map attrs = getScopeAttributes();
    if (attrs != null) {
      BeanStore beanstore = (BeanStore) attrs.get(BEAN_STORE);
      if (beanstore == null) {
        beanstore = new AbstractBeanStore();
        attrs.put(BEAN_STORE, beanstore);
      }
      return beanstore;
View Full Code Here

Examples of org.jboss.weld.context.api.BeanStore

         throw new IllegalStateException("No " + WeldManager.class.getName() + " found in context");
      }
      ContextLifecycle lifeCycle = manager.getServices().get(ContextLifecycle.class);

      String requestId = UUID.randomUUID().toString();
      BeanStore beanStore = new ConcurrentHashMapBeanStore();
     
      lifeCycle.beginRequest(requestId, beanStore);
     
      context.register(endRequestEvent, new DestoryRequest(requestId, beanStore));
   }
View Full Code Here

Examples of org.jboss.weld.context.api.BeanStore

         throw new IllegalStateException("No " + WeldManager.class.getName() + " found in context");
      }
      ContextLifecycle lifeCycle = manager.getServices().get(ContextLifecycle.class);

      String sessionId = UUID.randomUUID().toString();
      BeanStore beanStore = new ConcurrentHashMapBeanStore();
     
      lifeCycle.restoreSession(sessionId, beanStore);
      context.register(endSessionEvent, new DestorySession(sessionId, beanStore));
   }
View Full Code Here

Examples of org.jboss.weld.context.api.BeanStore

         throw new IllegalStateException("No " + WeldManager.class.getName() + " found in context");
      }
      ContextLifecycle lifeCycle = manager.getServices().get(ContextLifecycle.class);

      String sessionId = UUID.randomUUID().toString();
      BeanStore beanStore = new ConcurrentHashMapBeanStore();
     
      lifeCycle.restoreSession(sessionId, beanStore);
      context.add(CDISessionID.class, new CDISessionID(sessionId, beanStore));
   }
View Full Code Here

Examples of org.jboss.weld.context.api.BeanStore

         throw new IllegalStateException("No " + WeldManager.class.getName() + " found in context");
      }
      ContextLifecycle lifeCycle = manager.getServices().get(ContextLifecycle.class);

      String requestId = UUID.randomUUID().toString();
      BeanStore beanStore = new ConcurrentHashMapBeanStore();
     
      lifeCycle.getDependentContext().setActive(true);
      lifeCycle.getRequestContext().setActive(true);
      lifeCycle.getRequestContext().setBeanStore(beanStore);
     
View Full Code Here

Examples of org.jboss.weld.context.beanstore.BeanStore

    public <T> T get(Contextual<T> contextual, CreationalContext<T> creationalContext) {
        if (!isActive()) {
            throw new ContextNotActiveException();
        }
        checkContextInitialized();
        BeanStore beanStore = getBeanStore();
        if (beanStore == null) {
            return null;
        }
        if (contextual == null) {
            throw ContextLogger.LOG.contextualIsNull();
        }
        BeanIdentifier id = getId(contextual);
        ContextualInstance<T> beanInstance = beanStore.get(id);
        if (beanInstance != null) {
            return beanInstance.getInstance();
        } else if (creationalContext != null) {
            LockedBean lock = null;
            try {
                if (multithreaded) {
                    lock = beanStore.lock(id);
                    beanInstance = beanStore.get(id);
                    if (beanInstance != null) {
                        return beanInstance.getInstance();
                    }
                }
                T instance = contextual.create(creationalContext);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.