Search in sources :

Example 6 with KieBaseEventListener

use of org.kie.api.event.kiebase.KieBaseEventListener in project drools by kiegroup.

the class StatefulKnowledgeSessionImpl method dispose.

public void dispose() {
    alive = false;
    if (pool != null) {
        pool.release(this);
        return;
    }
    if (!agenda.dispose(this)) {
        return;
    }
    if (logger != null) {
        try {
            logger.close();
        } catch (Exception e) {
        /* the logger was already closed, swallow */
        }
    }
    for (WorkingMemoryEntryPoint ep : this.entryPointsManager.getEntryPoints()) {
        ep.dispose();
    }
    for (AsyncReceiveNode.AsyncReceiveMemory receiveMemory : this.receiveNodeMemories) {
        receiveMemory.dispose();
    }
    this.ruleRuntimeEventSupport.clear();
    this.ruleEventListenerSupport.clear();
    this.agendaEventSupport.clear();
    for (KieBaseEventListener listener : kieBaseEventListeners) {
        this.kBase.removeEventListener(listener);
    }
    if (this.processRuntime != null) {
        this.processRuntime.dispose();
    }
    if (this.timerService != null) {
        this.timerService.shutdown();
    }
    if (this.workItemManager != null) {
        ((org.drools.core.process.instance.WorkItemManager) this.workItemManager).dispose();
    }
    this.kBase.disposeStatefulSession(this);
    if (this.mbeanRegistered.get()) {
        DroolsManagementAgent.getInstance().unregisterKnowledgeSessionUnderName(mbeanRegisteredCBSKey, this);
    }
}
Also used : KieBaseEventListener(org.kie.api.event.kiebase.KieBaseEventListener) AsyncReceiveNode(org.drools.core.reteoo.AsyncReceiveNode) WorkingMemoryEntryPoint(org.drools.core.WorkingMemoryEntryPoint) WorkItemManager(org.kie.api.runtime.process.WorkItemManager) IOException(java.io.IOException)

Aggregations

KieBaseEventListener (org.kie.api.event.kiebase.KieBaseEventListener)6 Test (org.junit.Test)3 KieBase (org.kie.api.KieBase)3 DefaultKieBaseEventListener (org.kie.api.event.kiebase.DefaultKieBaseEventListener)3 IOException (java.io.IOException)2 WorkingMemoryEntryPoint (org.drools.core.WorkingMemoryEntryPoint)2 WorkItemManager (org.kie.api.runtime.process.WorkItemManager)2 AtomicLong (java.util.concurrent.atomic.AtomicLong)1 ReentrantLock (java.util.concurrent.locks.ReentrantLock)1 MapGlobalResolver (org.drools.core.base.MapGlobalResolver)1 InternalWorkingMemoryEntryPoint (org.drools.core.common.InternalWorkingMemoryEntryPoint)1 KnowledgeBaseImpl (org.drools.core.impl.KnowledgeBaseImpl)1 AsyncReceiveNode (org.drools.core.reteoo.AsyncReceiveNode)1 GlobalResolver (org.drools.core.spi.GlobalResolver)1 Globals (org.kie.api.runtime.Globals)1