use of org.drools.core.management.DroolsManagementAgent.CBSKey in project drools by kiegroup.
the class KieContainerImpl method dispose.
public void dispose() {
kBases.values().forEach(kb -> ((InternalKnowledgeBase) kb).setKieContainer(null));
Set<DroolsManagementAgent.CBSKey> cbskeys = new HashSet<DroolsManagementAgent.CBSKey>();
if (isMBeanOptionEnabled()) {
for (Entry<String, KieSession> kv : kSessions.entrySet()) {
cbskeys.add(new DroolsManagementAgent.CBSKey(containerId, ((InternalKnowledgeBase) kv.getValue().getKieBase()).getId(), kv.getKey()));
}
for (Entry<String, StatelessKieSession> kv : statelessKSessions.entrySet()) {
cbskeys.add(new DroolsManagementAgent.CBSKey(containerId, ((InternalKnowledgeBase) kv.getValue().getKieBase()).getId(), kv.getKey()));
}
}
for (KieSession kieSession : kSessions.values()) {
kieSession.dispose();
}
kSessions.clear();
statelessKSessions.clear();
if (isMBeanOptionEnabled()) {
for (CBSKey c : cbskeys) {
DroolsManagementAgent.getInstance().unregisterKnowledgeSessionBean(c);
}
for (KieBase kb : kBases.values()) {
DroolsManagementAgent.getInstance().unregisterKnowledgeBase((InternalKnowledgeBase) kb);
}
DroolsManagementAgent.getInstance().unregisterMBeansFromOwner(this);
}
((InternalKieServices) KieServices.Factory.get()).clearRefToContainerId(this.containerId, this);
}
Aggregations