Package org.apache.deltaspike.core.util.context

Examples of org.apache.deltaspike.core.util.context.ContextualStorage


    @Override
    protected ContextualStorage getContextualStorage(Contextual<?> contextual, boolean createIfNotExists)
    {
        if (storage == null && createIfNotExists)
        {
            storage = new ContextualStorage(beanManager, concurrent, isPassivatingScope());
        }

        return storage;
    }
View Full Code Here


        this.usePassivationCapableStorage = usePassivationCapableStorage;
    }

    public ContextualStorage getContextualStorage(BeanManager beanManager, K key, boolean createIfNotExist)
    {
        ContextualStorage contextualStorage = storageMap.get(key);

        if (contextualStorage == null && createIfNotExist)
        {
            contextualStorage = createContextualStorage(beanManager, key);
        }
View Full Code Here

        return contextualStorage;
    }

    protected synchronized ContextualStorage createContextualStorage(BeanManager beanManager, K key)
    {
        ContextualStorage contextualStorage = storageMap.get(key);
        if (contextualStorage == null)
        {
            contextualStorage = new ContextualStorage(beanManager, useConcurrentStorage, usePassivationCapableStorage);
            storageMap.put(key, contextualStorage);
        }
        return contextualStorage;
    }
View Full Code Here

        viewAccessBeanAccessHistory.getAccessedBeans().clear();
    }
   
    private void destroyExpiredBeans()
    {
        ContextualStorage storage = viewAccessBeanHolder.getContextualStorage(beanManager, KEY, false);
        if (storage != null)
        {
            for (Map.Entry<Object, ContextualInstanceInfo<?>> storageEntry : storage.getStorage().entrySet())
            {
                if (!viewAccessBeanAccessHistory.getAccessedBeans().contains((String) storageEntry.getKey()))
                {
                    Contextual bean = storage.getBean(storageEntry.getKey());
                    AbstractContext.destroyBean(bean, storageEntry.getValue());
                    storage.getStorage().remove(storageEntry.getKey()); //ok due to ConcurrentHashMap
                }
            }
        }
    }
View Full Code Here

        if (windowId == null)
        {
            return false;
        }

        ContextualStorage windowStorage = windowBeanHolder.getStorageMap().remove(windowId);

        if (windowStorage != null)
        {
            if (windowId.equals(this.windowIdHolder.getWindowId()))
            {
View Full Code Here

    @Override
    public ContextualStorage closeConversation(Class<?> conversationGroup, Annotation... qualifiers)
    {
        ConversationKey conversationKey = new ConversationKey(conversationGroup, qualifiers);
        ContextualStorage contextualStorage = this.conversationBeanHolder.getStorageMap().remove(conversationKey);

        if (contextualStorage != null)
        {
            AbstractContext.destroyAllActive(contextualStorage);
        }
View Full Code Here

        return result;
    }

    private void tryToDestroySubGroup(Set<Class<?>> subGroups, Map.Entry<ConversationKey, ContextualStorage> entry)
    {
        ContextualStorage storage = entry.getValue();

        for (Map.Entry<Object, ContextualInstanceInfo<?>> storageEntry : storage.getStorage().entrySet())
        {
            for (Class<?> subGroup : subGroups)
            {
                Class classOfEntry = storageEntry.getValue().getContextualInstance().getClass();
                if (subGroup.equals(classOfEntry) ||
                    (subGroup.isInterface() && subGroup.isAssignableFrom(classOfEntry)))
                {
                    Contextual bean = storage.getBean(storageEntry.getKey());
                    AbstractContext.destroyBean(bean, storageEntry.getValue());
                    storage.getStorage().remove(storageEntry.getKey()); //ok due to ConcurrentHashMap
                    break;
                }
            }
        }
    }
View Full Code Here

    @Override
    protected ContextualStorage getContextualStorage(Contextual<?> contextual, boolean createIfNotExists)
    {
        Map<String, Object> viewMap = getViewMap();
        ContextualStorage storage = (ContextualStorage) viewMap.get(CONTEXTUAL_MAP_NAME);

        if (storage == null && createIfNotExists)
        {
            storage = new ContextualStorage(beanManager, false, isPassivatingScope());
            viewMap.put(CONTEXTUAL_MAP_NAME, storage);
        }

        return storage;
    }
View Full Code Here

     * @param beanManager we need the CDI {@link BeanManager} for serialisation.
     * @param windowId the windowId for the current browser tab or window.
     */
    public ContextualStorage getContextualStorage(BeanManager beanManager, String windowId)
    {
        ContextualStorage contextualStorage = storageMap.get(windowId);
        if (contextualStorage == null)
        {
            synchronized (this)
            {
                contextualStorage = storageMap.get(windowId);
                if (contextualStorage == null)
                {
                    storageMap.put(windowId, new ContextualStorage(beanManager, true, true));
                }
            }
        }

        return contextualStorage;
View Full Code Here

        if (windowId == null)
        {
            return false;
        }

        ContextualStorage windowStorage = windowBeanHolder.getContextualStorage(beanManager, windowId);
        if (windowStorage == null)
        {
            return false;
        }
View Full Code Here

TOP

Related Classes of org.apache.deltaspike.core.util.context.ContextualStorage

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.