Package org.gatein.cdi.contexts.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


        }
    }

    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

        }
    }

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

TOP

Related Classes of org.gatein.cdi.contexts.beanstore.BeanStore

Copyright © 2018 www.massapicom. 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.