@Override public void activate() { super.activate(); RequestScopedCache.beginRequest(); }
@Override public void deactivate() { try { RequestScopedCache.endRequest(); } finally { super.deactivate(); } }
public boolean dissociate(S storage) { if (getBeanStore() != null) { try { setBeanStore(null); return true; } finally { cleanup(); } } else { return false; } }
@Override public void clearAndSet(Collection<ContextualInstance<?>> setOfInstances) { // bound context can be multithreaded, in such case we perform locking BoundBeanStore boundBeanStore = getBeanStore(); boundBeanStore.clear(); for (ContextualInstance<?> contextualInstance : setOfInstances) { BeanIdentifier id = getId(contextualInstance.getContextual()); LockedBean lock = null; try { if (isMultithreaded()) { lock = boundBeanStore.lock(id); } getBeanStore().put(getId(contextualInstance.getContextual()), contextualInstance); } finally { if (lock != null) { lock.unlock(); } } } } }
@Override public Collection<ContextualInstance<?>> getAllContextualInstances() { Set<ContextualInstance<?>> result = new HashSet<>(); // for instance lazily initialized conversation scope may be active but have null here BeanStore beanStore = getBeanStore(); if (beanStore != null) { getBeanStore().iterator().forEachRemaining((BeanIdentifier beanId) -> { result.add(getBeanStore().get(beanId)); }); } return result; }
@Override public void activate(String cid) { if (!isAssociated()) { throw ConversationLogger.LOG.mustCallAssociateBeforeActivate(); } if (!isActive()) { super.setActive(true); } else { ConversationLogger.LOG.contextAlreadyActive(getRequest()); } initialize(cid); }
@Override public void invalidate() { super.invalidate(); getBeanStore().detach(); } }
@Override public void clearAndSet(Collection<ContextualInstance<?>> setOfInstances) { // bound context can be multithreaded, in such case we perform locking BoundBeanStore boundBeanStore = getBeanStore(); boundBeanStore.clear(); for (ContextualInstance<?> contextualInstance : setOfInstances) { BeanIdentifier id = getId(contextualInstance.getContextual()); LockedBean lock = null; try { if (isMultithreaded()) { lock = boundBeanStore.lock(id); } getBeanStore().put(getId(contextualInstance.getContextual()), contextualInstance); } finally { if (lock != null) { lock.unlock(); } } } } }
@Override public Collection<ContextualInstance<?>> getAllContextualInstances() { Set<ContextualInstance<?>> result = new HashSet<>(); // for instance lazily initialized conversation scope may be active but have null here BeanStore beanStore = getBeanStore(); if (beanStore != null) { getBeanStore().iterator().forEachRemaining((BeanIdentifier beanId) -> { result.add(getBeanStore().get(beanId)); }); } return result; }
@Override public void activate(String cid) { if (!isAssociated()) { throw ConversationLogger.LOG.mustCallAssociateBeforeActivate(); } if (!isActive()) { super.setActive(true); } else { ConversationLogger.LOG.contextAlreadyActive(getRequest()); } initialize(cid); }
@Override public void invalidate() { super.invalidate(); getBeanStore().detach(); } }
public boolean dissociate(S storage) { if (getBeanStore() != null) { try { setBeanStore(null); return true; } finally { cleanup(); } } else { return false; } }
@Override public void clearAndSet(Collection<ContextualInstance<?>> setOfInstances) { // bound context can be multithreaded, in such case we perform locking BoundBeanStore boundBeanStore = getBeanStore(); boundBeanStore.clear(); for (ContextualInstance<?> contextualInstance : setOfInstances) { BeanIdentifier id = getId(contextualInstance.getContextual()); LockedBean lock = null; try { if (isMultithreaded()) { lock = boundBeanStore.lock(id); } getBeanStore().put(getId(contextualInstance.getContextual()), contextualInstance); } finally { if (lock != null) { lock.unlock(); } } } } }
@Override public void activate() { super.activate(); RequestScopedCache.beginRequest(); }
@Override public void deactivate() { try { RequestScopedCache.endRequest(); } finally { super.deactivate(); } }
@Override public Collection<ContextualInstance<?>> getAllContextualInstances() { Set<ContextualInstance<?>> result = new HashSet<>(); // for instance lazily initialized conversation scope may be active but have null here BeanStore beanStore = getBeanStore(); if (beanStore != null) { getBeanStore().iterator().forEachRemaining((BeanIdentifier beanId) -> { result.add(getBeanStore().get(beanId)); }); } return result; }
@Override public void activate(String cid) { if (!isAssociated()) { throw ConversationLogger.LOG.mustCallAssociateBeforeActivate(); } if (!isActive()) { super.setActive(true); } else { ConversationLogger.LOG.contextAlreadyActive(getRequest()); } initialize(cid); }
@Override public void invalidate() { super.invalidate(); getBeanStore().detach(); } }
public boolean dissociate(S storage) { if (getBeanStore() != null) { try { setBeanStore(null); return true; } finally { cleanup(); } } else { return false; } }
@Override public void clearAndSet(Collection<ContextualInstance<?>> setOfInstances) { BoundBeanStore boundBeanStore = getBeanStore(); // for instance lazily initialized conversation scope may be active but have null here if (boundBeanStore != null) { boundBeanStore.clear(); for (ContextualInstance<?> contextualInstance : setOfInstances) { // bound context can be multithreaded, in such case we perform locking BeanIdentifier id = getId(contextualInstance.getContextual()); LockedBean lock = null; try { if (isMultithreaded()) { lock = boundBeanStore.lock(id); } getBeanStore().put(getId(contextualInstance.getContextual()), contextualInstance); } finally { if (lock != null) { lock.unlock(); } } } } } }