use of org.jboss.weld.context.api.ContextualInstance in project core by weld.
the class AttributeBeanStore method fetchUninitializedAttributes.
/**
* Fetch all relevant attributes from the backing store and copy instances which are not present in the local bean store.
*/
public void fetchUninitializedAttributes() {
for (String prefixedId : getPrefixedAttributeNames()) {
BeanIdentifier id = getNamingScheme().deprefix(prefixedId);
if (!beanStore.contains(id)) {
ContextualInstance<?> instance = (ContextualInstance<?>) getAttribute(prefixedId);
beanStore.put(id, instance);
ContextLogger.LOG.addingDetachedContextualUnderId(instance, id);
}
}
}
use of org.jboss.weld.context.api.ContextualInstance in project core by weld.
the class AbstractConversationContext method setDestructionQueue.
private void setDestructionQueue(Map<String, ManagedConversation> conversations, S session) {
Map<String, List<ContextualInstance<?>>> contexts = new HashMap<>();
for (Entry<String, ManagedConversation> entry : conversations.entrySet()) {
ManagedConversation conversation = entry.getValue();
// First make all conversations transient
if (!conversation.isTransient()) {
conversation.end();
}
// Extract contextual instances
List<ContextualInstance<?>> contextualInstances = new ArrayList<>();
for (String id : new ConversationNamingScheme(getNamingSchemePrefix(), entry.getKey(), beanIdentifierIndex).filterIds(getSessionAttributeNames(session))) {
contextualInstances.add((ContextualInstance<?>) getSessionAttributeFromSession(session, id));
}
contexts.put(entry.getKey(), contextualInstances);
}
// Store remaining conversation contexts for later destruction
setRequestAttribute(getRequest(), DESTRUCTION_QUEUE_ATTRIBUTE_NAME, Collections.synchronizedMap(contexts));
}
Aggregations