use of org.apache.deltaspike.core.util.context.ContextualInstanceInfo in project deltaspike by apache.
the class GroupedConversationContext method tryToDestroySubGroup.
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());
//ok due to ConcurrentHashMap
storage.getStorage().remove(storageEntry.getKey());
break;
}
}
}
}
use of org.apache.deltaspike.core.util.context.ContextualInstanceInfo in project deltaspike by apache.
the class ViewAccessContext method destroyExpiredBeans.
private void destroyExpiredBeans(boolean force) {
ContextualStorage storage = viewAccessBeanHolder.getContextualStorage(beanManager, KEY, false);
if (storage != null) {
for (Map.Entry<Object, ContextualInstanceInfo<?>> storageEntry : storage.getStorage().entrySet()) {
if (force || !viewAccessBeanAccessHistory.getAccessedBeans().contains((String) storageEntry.getKey())) {
Contextual bean = storage.getBean(storageEntry.getKey());
AbstractContext.destroyBean(bean, storageEntry.getValue());
//ok due to ConcurrentHashMap
storage.getStorage().remove(storageEntry.getKey());
}
}
}
}
Aggregations