Class StatefulKnowledgeSessionImpl

  • All Implemented Interfaces:
    Externalizable, Serializable, org.drools.core.common.EventSupport, org.drools.core.common.InternalKnowledgeRuntime, org.drools.core.common.InternalWorkingMemory, org.drools.core.common.InternalWorkingMemoryActions, org.drools.core.common.ReteEvaluator, org.drools.core.WorkingMemory, org.drools.core.WorkingMemoryEntryPoint, org.drools.core.WorkingMemoryEventManager, org.kie.api.event.kiebase.KieBaseEventManager, org.kie.api.event.KieRuntimeEventManager, org.kie.api.event.process.ProcessEventManager, org.kie.api.event.rule.RuleRuntimeEventManager, org.kie.api.runtime.CommandExecutor, org.kie.api.runtime.KieRuntime, org.kie.api.runtime.KieSession, org.kie.api.runtime.process.ProcessRuntime, org.kie.api.runtime.process.StatefulProcessSession, org.kie.api.runtime.rule.EntryPoint, org.kie.api.runtime.rule.RuleRuntime, org.kie.api.runtime.rule.StatefulRuleSession, org.kie.internal.event.rule.RuleEventManager, org.kie.internal.process.CorrelationAwareProcessRuntime, org.kie.internal.runtime.StatefulKnowledgeSession

    public class StatefulKnowledgeSessionImpl
    extends org.drools.core.impl.AbstractRuntime
    implements org.kie.internal.runtime.StatefulKnowledgeSession, org.drools.core.WorkingMemoryEntryPoint, org.drools.core.common.InternalKnowledgeRuntime, org.kie.api.runtime.KieSession, org.kie.api.event.KieRuntimeEventManager, org.drools.core.common.InternalWorkingMemoryActions, org.drools.core.common.EventSupport, org.kie.internal.event.rule.RuleEventManager, org.kie.api.event.process.ProcessEventManager, org.kie.internal.process.CorrelationAwareProcessRuntime, Externalizable
    See Also:
    Serialized Form
    • Field Detail

      • bytes

        public byte[] bytes
      • id

        protected Long id
      • globalResolver

        protected org.drools.core.rule.accessor.GlobalResolver globalResolver
        Global values which are associated with this memory.
      • calendars

        protected org.kie.api.runtime.Calendars calendars
      • ruleRuntimeEventSupport

        protected org.drools.core.event.RuleRuntimeEventSupport ruleRuntimeEventSupport
        The eventSupport
      • ruleEventListenerSupport

        protected org.drools.core.event.RuleEventListenerSupport ruleEventListenerSupport
      • agendaEventSupport

        protected org.drools.core.event.AgendaEventSupport agendaEventSupport
      • kieBaseEventListeners

        protected List<org.kie.api.event.kiebase.KieBaseEventListener> kieBaseEventListeners
      • kBase

        protected transient InternalKnowledgeBase kBase
        The RuleBase with which this memory is associated.
      • handleFactory

        protected org.drools.core.rule.accessor.FactHandleFactory handleFactory
      • agenda

        protected org.drools.core.common.InternalAgenda agenda
        Rule-firing agenda.
      • initialFactHandle

        protected org.drools.core.common.InternalFactHandle initialFactHandle
      • config

        protected org.drools.core.SessionConfiguration config
    • Constructor Detail

      • StatefulKnowledgeSessionImpl

        public StatefulKnowledgeSessionImpl()
      • StatefulKnowledgeSessionImpl

        public StatefulKnowledgeSessionImpl​(long id,
                                            InternalKnowledgeBase kBase)
      • StatefulKnowledgeSessionImpl

        public StatefulKnowledgeSessionImpl​(long id,
                                            InternalKnowledgeBase kBase,
                                            boolean initInitFactHandle,
                                            org.drools.core.SessionConfiguration config,
                                            org.kie.api.runtime.Environment environment)
      • StatefulKnowledgeSessionImpl

        public StatefulKnowledgeSessionImpl​(long id,
                                            InternalKnowledgeBase kBase,
                                            org.drools.core.rule.accessor.FactHandleFactory handleFactory,
                                            long propagationContext,
                                            org.drools.core.SessionConfiguration config,
                                            org.drools.core.common.InternalAgenda agenda,
                                            org.kie.api.runtime.Environment environment)
    • Method Detail

      • init

        public void init​(org.drools.core.SessionConfiguration config,
                         org.kie.api.runtime.Environment environment)
      • initMBeans

        public void initMBeans​(String containerId,
                               String kbaseName,
                               String ksessionName)
      • getHandleFactory

        public org.drools.core.rule.accessor.FactHandleFactory getHandleFactory()
        Specified by:
        getHandleFactory in interface org.drools.core.WorkingMemoryEntryPoint
      • setHandleFactory

        public void setHandleFactory​(org.drools.core.rule.accessor.FactHandleFactory handleFactory)
      • getKieRuntime

        public <T> T getKieRuntime​(Class<T> cls)
        Specified by:
        getKieRuntime in interface org.kie.api.runtime.KieSession
      • createRuntimeService

        public <T> T createRuntimeService​(Class<T> cls)
      • getEntryPoint

        public org.drools.core.WorkingMemoryEntryPoint getEntryPoint​(String name)
        Specified by:
        getEntryPoint in interface org.drools.core.common.ReteEvaluator
        Specified by:
        getEntryPoint in interface org.kie.api.runtime.rule.RuleRuntime
      • getEntryPoints

        public Collection<? extends org.kie.api.runtime.rule.EntryPoint> getEntryPoints()
        Specified by:
        getEntryPoints in interface org.drools.core.common.InternalWorkingMemory
        Specified by:
        getEntryPoints in interface org.drools.core.common.ReteEvaluator
        Specified by:
        getEntryPoints in interface org.kie.api.runtime.rule.RuleRuntime
      • getRuleRuntimeEventListeners

        public Collection<org.kie.api.event.rule.RuleRuntimeEventListener> getRuleRuntimeEventListeners()
        Specified by:
        getRuleRuntimeEventListeners in interface org.drools.core.common.EventSupport
        Specified by:
        getRuleRuntimeEventListeners in interface org.kie.api.event.rule.RuleRuntimeEventManager
        Specified by:
        getRuleRuntimeEventListeners in interface org.drools.core.WorkingMemoryEventManager
      • getAgendaEventListeners

        public Collection<org.kie.api.event.rule.AgendaEventListener> getAgendaEventListeners()
        Specified by:
        getAgendaEventListeners in interface org.drools.core.common.EventSupport
        Specified by:
        getAgendaEventListeners in interface org.kie.api.event.rule.RuleRuntimeEventManager
        Specified by:
        getAgendaEventListeners in interface org.drools.core.WorkingMemoryEventManager
      • getProcessRuntime

        public org.drools.core.runtime.process.InternalProcessRuntime getProcessRuntime()
        Specified by:
        getProcessRuntime in interface org.drools.core.common.InternalKnowledgeRuntime
        Specified by:
        getProcessRuntime in interface org.drools.core.common.InternalWorkingMemory
      • internalGetProcessRuntime

        public org.drools.core.runtime.process.InternalProcessRuntime internalGetProcessRuntime()
        Specified by:
        internalGetProcessRuntime in interface org.drools.core.common.InternalWorkingMemory
      • addEventListener

        public void addEventListener​(org.kie.api.event.process.ProcessEventListener listener)
        Specified by:
        addEventListener in interface org.kie.api.event.process.ProcessEventManager
      • getProcessEventListeners

        public Collection<org.kie.api.event.process.ProcessEventListener> getProcessEventListeners()
        Specified by:
        getProcessEventListeners in interface org.kie.api.event.process.ProcessEventManager
      • removeEventListener

        public void removeEventListener​(org.kie.api.event.process.ProcessEventListener listener)
        Specified by:
        removeEventListener in interface org.kie.api.event.process.ProcessEventManager
      • getKieBase

        public org.kie.api.KieBase getKieBase()
        Specified by:
        getKieBase in interface org.kie.api.runtime.KieRuntime
      • dispose

        public void dispose()
        Specified by:
        dispose in interface org.kie.api.runtime.KieSession
        Specified by:
        dispose in interface org.drools.core.common.ReteEvaluator
        Specified by:
        dispose in interface org.drools.core.WorkingMemoryEntryPoint
      • isAlive

        public boolean isAlive()
      • destroy

        public void destroy()
        Specified by:
        destroy in interface org.kie.api.runtime.KieSession
      • update

        public void update​(org.kie.api.runtime.rule.FactHandle factHandle)
      • abortProcessInstance

        public void abortProcessInstance​(String id)
        Specified by:
        abortProcessInstance in interface org.kie.api.runtime.process.ProcessRuntime
      • signalEvent

        public void signalEvent​(String type,
                                Object event)
        Specified by:
        signalEvent in interface org.kie.api.runtime.process.ProcessRuntime
      • signalEvent

        public void signalEvent​(String type,
                                Object event,
                                String processInstanceId)
        Specified by:
        signalEvent in interface org.kie.api.runtime.process.ProcessRuntime
      • getGlobals

        public org.kie.api.runtime.Globals getGlobals()
        Specified by:
        getGlobals in interface org.kie.api.runtime.KieRuntime
      • getFactHandles

        public <T extends org.kie.api.runtime.rule.FactHandle> Collection<T> getFactHandles()
        Specified by:
        getFactHandles in interface org.kie.api.runtime.rule.EntryPoint
      • getFactHandles

        public <T extends org.kie.api.runtime.rule.FactHandle> Collection<T> getFactHandles​(org.kie.api.runtime.ObjectFilter filter)
        Specified by:
        getFactHandles in interface org.kie.api.runtime.rule.EntryPoint
      • getObjects

        public Collection<?> getObjects()
        Specified by:
        getObjects in interface org.kie.api.runtime.rule.EntryPoint
      • getObjects

        public Collection<?> getObjects​(org.kie.api.runtime.ObjectFilter filter)
        Specified by:
        getObjects in interface org.kie.api.runtime.rule.EntryPoint
      • execute

        public <T> T execute​(org.kie.api.command.Command<T> command)
        Specified by:
        execute in interface org.kie.api.runtime.CommandExecutor
      • initInitialFact

        public org.drools.core.common.InternalFactHandle initInitialFact​(org.drools.core.marshalling.MarshallerReaderContext context)
      • getEntryPointId

        public String getEntryPointId()
        Specified by:
        getEntryPointId in interface org.kie.api.runtime.rule.EntryPoint
      • getQueryResultsFromRHS

        public org.drools.core.QueryResultsImpl getQueryResultsFromRHS​(String queryName,
                                                                       Object... arguments)
        (This shall NOT be exposed on public API)
      • getQueryResults

        public org.drools.core.QueryResultsImpl getQueryResults​(String queryName,
                                                                Object... arguments)
        Specified by:
        getQueryResults in interface org.drools.core.common.ReteEvaluator
        Specified by:
        getQueryResults in interface org.kie.api.runtime.rule.RuleRuntime
        Specified by:
        getQueryResults in interface org.drools.core.WorkingMemory
      • internalGetQueryResult

        protected org.drools.core.QueryResultsImpl internalGetQueryResult​(boolean calledFromRHS,
                                                                          String queryName,
                                                                          Object... arguments)
      • openLiveQuery

        public org.kie.api.runtime.rule.LiveQuery openLiveQuery​(String query,
                                                                Object[] arguments,
                                                                org.kie.api.runtime.rule.ViewChangedEventListener listener)
        Specified by:
        openLiveQuery in interface org.kie.api.runtime.rule.RuleRuntime
      • closeLiveQuery

        public void closeLiveQuery​(org.drools.core.common.InternalFactHandle factHandle)
        Specified by:
        closeLiveQuery in interface org.drools.core.common.InternalWorkingMemory
      • getEntryPoint

        public org.drools.core.rule.EntryPointId getEntryPoint()
        Specified by:
        getEntryPoint in interface org.drools.core.WorkingMemoryEntryPoint
      • getReteEvaluator

        public org.drools.core.common.ReteEvaluator getReteEvaluator()
        Specified by:
        getReteEvaluator in interface org.drools.core.WorkingMemoryEntryPoint
      • updateEntryPointsCache

        public void updateEntryPointsCache()
        Specified by:
        updateEntryPointsCache in interface org.drools.core.common.InternalWorkingMemory
      • getSessionConfiguration

        public org.drools.core.SessionConfiguration getSessionConfiguration()
        Specified by:
        getSessionConfiguration in interface org.kie.api.runtime.KieRuntime
        Specified by:
        getSessionConfiguration in interface org.drools.core.common.ReteEvaluator
      • reset

        public void reset()
        Specified by:
        reset in interface org.drools.core.WorkingMemoryEntryPoint
      • reset

        public void reset​(long handleId,
                          long handleCounter,
                          long propagationCounter)
      • setRuleRuntimeEventSupport

        public void setRuleRuntimeEventSupport​(org.drools.core.event.RuleRuntimeEventSupport ruleRuntimeEventSupport)
        Specified by:
        setRuleRuntimeEventSupport in interface org.drools.core.common.InternalWorkingMemory
      • setAgendaEventSupport

        public void setAgendaEventSupport​(org.drools.core.event.AgendaEventSupport agendaEventSupport)
        Specified by:
        setAgendaEventSupport in interface org.drools.core.common.InternalWorkingMemory
      • isSequential

        public boolean isSequential()
        Specified by:
        isSequential in interface org.drools.core.common.ReteEvaluator
      • addEventListener

        public void addEventListener​(org.kie.api.event.rule.RuleRuntimeEventListener listener)
        Specified by:
        addEventListener in interface org.kie.api.event.rule.RuleRuntimeEventManager
        Specified by:
        addEventListener in interface org.drools.core.WorkingMemoryEventManager
      • removeEventListener

        public void removeEventListener​(org.kie.api.event.rule.RuleRuntimeEventListener listener)
        Specified by:
        removeEventListener in interface org.kie.api.event.rule.RuleRuntimeEventManager
        Specified by:
        removeEventListener in interface org.drools.core.WorkingMemoryEventManager
      • addEventListener

        public void addEventListener​(org.kie.api.event.rule.AgendaEventListener listener)
        Specified by:
        addEventListener in interface org.kie.api.event.rule.RuleRuntimeEventManager
        Specified by:
        addEventListener in interface org.drools.core.WorkingMemoryEventManager
      • removeEventListener

        public void removeEventListener​(org.kie.api.event.rule.AgendaEventListener listener)
        Specified by:
        removeEventListener in interface org.kie.api.event.rule.RuleRuntimeEventManager
        Specified by:
        removeEventListener in interface org.drools.core.WorkingMemoryEventManager
      • addEventListener

        public void addEventListener​(org.kie.api.event.kiebase.KieBaseEventListener listener)
        Specified by:
        addEventListener in interface org.kie.api.event.kiebase.KieBaseEventManager
      • getKieBaseEventListeners

        public Collection<org.kie.api.event.kiebase.KieBaseEventListener> getKieBaseEventListeners()
        Specified by:
        getKieBaseEventListeners in interface org.kie.api.event.kiebase.KieBaseEventManager
      • removeEventListener

        public void removeEventListener​(org.kie.api.event.kiebase.KieBaseEventListener listener)
        Specified by:
        removeEventListener in interface org.kie.api.event.kiebase.KieBaseEventManager
      • getRuleEventSupport

        public org.drools.core.event.RuleEventListenerSupport getRuleEventSupport()
        Specified by:
        getRuleEventSupport in interface org.drools.core.common.EventSupport
        Specified by:
        getRuleEventSupport in interface org.drools.core.common.ReteEvaluator
      • setRuleEventListenerSupport

        public void setRuleEventListenerSupport​(org.drools.core.event.RuleEventListenerSupport ruleEventListenerSupport)
      • addEventListener

        public void addEventListener​(org.kie.internal.event.rule.RuleEventListener listener)
        Specified by:
        addEventListener in interface org.kie.internal.event.rule.RuleEventManager
      • removeEventListener

        public void removeEventListener​(org.kie.internal.event.rule.RuleEventListener listener)
        Specified by:
        removeEventListener in interface org.kie.internal.event.rule.RuleEventManager
      • getFactHandleFactory

        public org.drools.core.rule.accessor.FactHandleFactory getFactHandleFactory()
        Specified by:
        getFactHandleFactory in interface org.drools.core.common.ReteEvaluator
      • setGlobal

        public void setGlobal​(String identifier,
                              Object value)
        Specified by:
        setGlobal in interface org.kie.api.runtime.KieRuntime
        Specified by:
        setGlobal in interface org.drools.core.common.ReteEvaluator
        Specified by:
        setGlobal in interface org.drools.core.WorkingMemory
      • removeGlobal

        public void removeGlobal​(String identifier)
        Specified by:
        removeGlobal in interface org.drools.core.common.InternalWorkingMemory
      • setGlobalResolver

        public void setGlobalResolver​(org.drools.core.rule.accessor.GlobalResolver globalResolver)
        Specified by:
        setGlobalResolver in interface org.drools.core.WorkingMemory
      • getGlobalResolver

        public org.drools.core.rule.accessor.GlobalResolver getGlobalResolver()
        Specified by:
        getGlobalResolver in interface org.drools.core.common.ReteEvaluator
      • getCalendars

        public org.kie.api.runtime.Calendars getCalendars()
        Specified by:
        getCalendars in interface org.kie.api.runtime.KieRuntime
        Specified by:
        getCalendars in interface org.drools.core.common.ReteEvaluator
      • getId

        public int getId()
        Specified by:
        getId in interface org.kie.api.runtime.KieSession
      • getIdentifier

        public long getIdentifier()
        Specified by:
        getIdentifier in interface org.drools.core.common.InternalWorkingMemory
        Specified by:
        getIdentifier in interface org.kie.api.runtime.KieSession
      • setIdentifier

        public void setIdentifier​(long id)
        Specified by:
        setIdentifier in interface org.drools.core.common.InternalKnowledgeRuntime
        Specified by:
        setIdentifier in interface org.drools.core.common.InternalWorkingMemory
      • checkAlive

        protected void checkAlive()
      • getGlobal

        public Object getGlobal​(String identifier)
        Specified by:
        getGlobal in interface org.kie.api.runtime.KieRuntime
        Specified by:
        getGlobal in interface org.drools.core.common.ReteEvaluator
      • getEnvironment

        public org.kie.api.runtime.Environment getEnvironment()
        Specified by:
        getEnvironment in interface org.kie.api.runtime.KieRuntime
        Specified by:
        getEnvironment in interface org.drools.core.WorkingMemory
      • getAgenda

        public org.drools.core.common.InternalAgenda getAgenda()
        Specified by:
        getAgenda in interface org.drools.core.common.InternalWorkingMemory
        Specified by:
        getAgenda in interface org.kie.api.runtime.rule.RuleRuntime
        Specified by:
        getAgenda in interface org.drools.core.WorkingMemory
      • clearAgenda

        public void clearAgenda()
        Specified by:
        clearAgenda in interface org.drools.core.WorkingMemory
      • clearAgendaGroup

        public void clearAgendaGroup​(String group)
        Specified by:
        clearAgendaGroup in interface org.drools.core.WorkingMemory
      • clearActivationGroup

        public void clearActivationGroup​(String group)
        Specified by:
        clearActivationGroup in interface org.drools.core.WorkingMemory
      • clearRuleFlowGroup

        public void clearRuleFlowGroup​(String group)
        Specified by:
        clearRuleFlowGroup in interface org.drools.core.WorkingMemory
      • getActivationsManager

        public org.drools.core.common.ActivationsManager getActivationsManager()
        Specified by:
        getActivationsManager in interface org.drools.core.common.ReteEvaluator
      • getKnowledgeBase

        public InternalKnowledgeBase getKnowledgeBase()
        Specified by:
        getKnowledgeBase in interface org.drools.core.common.ReteEvaluator
        Specified by:
        getKnowledgeBase in interface org.drools.core.WorkingMemoryEntryPoint
      • halt

        public void halt()
        Specified by:
        halt in interface org.kie.api.runtime.rule.RuleRuntime
        Specified by:
        halt in interface org.drools.core.WorkingMemory
      • fireAllRules

        public int fireAllRules()
        Specified by:
        fireAllRules in interface org.drools.core.common.ReteEvaluator
        Specified by:
        fireAllRules in interface org.kie.api.runtime.rule.StatefulRuleSession
        Specified by:
        fireAllRules in interface org.drools.core.WorkingMemory
      • fireAllRules

        public int fireAllRules​(int fireLimit)
        Specified by:
        fireAllRules in interface org.drools.core.common.ReteEvaluator
        Specified by:
        fireAllRules in interface org.kie.api.runtime.rule.StatefulRuleSession
        Specified by:
        fireAllRules in interface org.drools.core.WorkingMemory
      • fireAllRules

        public int fireAllRules​(org.kie.api.runtime.rule.AgendaFilter agendaFilter)
        Specified by:
        fireAllRules in interface org.drools.core.common.ReteEvaluator
        Specified by:
        fireAllRules in interface org.kie.api.runtime.rule.StatefulRuleSession
        Specified by:
        fireAllRules in interface org.drools.core.WorkingMemory
      • fireAllRules

        public int fireAllRules​(org.kie.api.runtime.rule.AgendaFilter agendaFilter,
                                int fireLimit)
        Specified by:
        fireAllRules in interface org.drools.core.common.ReteEvaluator
        Specified by:
        fireAllRules in interface org.kie.api.runtime.rule.StatefulRuleSession
        Specified by:
        fireAllRules in interface org.drools.core.WorkingMemory
      • fireUntilHalt

        public void fireUntilHalt()
        Keeps firing activations until a halt is called. If in a given moment, there is no activation to fire, it will wait for an activation to be added to an active agenda group or rule flow group.
        Specified by:
        fireUntilHalt in interface org.kie.api.runtime.rule.StatefulRuleSession
        Throws:
        IllegalStateException - if this method is called when running in sequential mode
      • fireUntilHalt

        public void fireUntilHalt​(org.kie.api.runtime.rule.AgendaFilter agendaFilter)
        Keeps firing activations until a halt is called. If in a given moment, there is no activation to fire, it will wait for an activation to be added to an active agenda group or rule flow group.
        Specified by:
        fireUntilHalt in interface org.kie.api.runtime.rule.StatefulRuleSession
        Parameters:
        agendaFilter - filters the activations that may fire
        Throws:
        IllegalStateException - if this method is called when running in sequential mode
      • getObject

        public Object getObject​(org.kie.api.runtime.rule.FactHandle handle)
        Returns the fact Object for the given FactHandle. It actually attempts to return the value from the handle, before retrieving it from objects map.
        Specified by:
        getObject in interface org.kie.api.runtime.rule.EntryPoint
        Parameters:
        handle - The FactHandle reference for the Object lookup
        See Also:
        WorkingMemory
      • getObjectStore

        public org.drools.core.common.ObjectStore getObjectStore()
        Specified by:
        getObjectStore in interface org.drools.core.WorkingMemoryEntryPoint
      • getFactHandle

        public org.drools.core.common.InternalFactHandle getFactHandle​(Object object)
        Specified by:
        getFactHandle in interface org.kie.api.runtime.rule.EntryPoint
        Specified by:
        getFactHandle in interface org.drools.core.common.ReteEvaluator
        See Also:
        WorkingMemory
      • iterateObjects

        public Iterator iterateObjects()
        This class is not thread safe, changes to the working memory during iteration may give unexpected results
        Specified by:
        iterateObjects in interface org.drools.core.WorkingMemory
      • iterateObjects

        public Iterator iterateObjects​(org.kie.api.runtime.ObjectFilter filter)
        This class is not thread safe, changes to the working memory during iteration may give unexpected results
        Specified by:
        iterateObjects in interface org.drools.core.WorkingMemory
      • iterateFactHandles

        public Iterator<org.drools.core.common.InternalFactHandle> iterateFactHandles()
        This class is not thread safe, changes to the working memory during iteration may give unexpected results
        Specified by:
        iterateFactHandles in interface org.drools.core.WorkingMemory
      • iterateFactHandles

        public Iterator<org.drools.core.common.InternalFactHandle> iterateFactHandles​(org.kie.api.runtime.ObjectFilter filter)
        This class is not thread safe, changes to the working memory during iteration may give unexpected results
        Specified by:
        iterateFactHandles in interface org.drools.core.WorkingMemory
      • setFocus

        public void setFocus​(String focus)
        Specified by:
        setFocus in interface org.drools.core.WorkingMemory
      • insertAsync

        public org.kie.api.runtime.rule.FactHandle insertAsync​(Object object)
        Specified by:
        insertAsync in interface org.drools.core.common.InternalWorkingMemoryActions
      • insert

        public org.kie.api.runtime.rule.FactHandle insert​(Object object)
        Specified by:
        insert in interface org.kie.api.runtime.rule.EntryPoint
        Specified by:
        insert in interface org.drools.core.common.ReteEvaluator
        See Also:
        WorkingMemory
      • insert

        public org.kie.api.runtime.rule.FactHandle insert​(Object object,
                                                          boolean dynamic)
        Specified by:
        insert in interface org.drools.core.WorkingMemoryEntryPoint
      • submit

        public void submit​(org.kie.api.runtime.KieSession.AtomicAction action)
        Specified by:
        submit in interface org.kie.api.runtime.KieSession
      • updateTraits

        public void updateTraits​(org.drools.core.common.InternalFactHandle h,
                                 org.drools.core.util.bitmask.BitMask mask,
                                 Class<?> modifiedClass,
                                 org.drools.core.rule.consequence.Activation activation)
        Specified by:
        updateTraits in interface org.drools.core.common.InternalWorkingMemoryActions
      • shed

        public <T,​K,​X extends org.drools.core.factmodel.traits.TraitableBean> org.drools.core.factmodel.traits.Thing<K> shed​(org.drools.core.rule.consequence.Activation activation,
                                                                                                                                         org.drools.core.factmodel.traits.TraitableBean<K,​X> core,
                                                                                                                                         Class<T> trait)
        Specified by:
        shed in interface org.drools.core.common.InternalWorkingMemoryActions
      • don

        public <T,​K> T don​(org.drools.core.rule.consequence.Activation activation,
                                 K core,
                                 Collection<Class<? extends org.drools.core.factmodel.traits.Thing>> traits,
                                 boolean b,
                                 org.drools.core.beliefsystem.Mode[] modes)
        Specified by:
        don in interface org.drools.core.common.InternalWorkingMemoryActions
      • don

        public <T,​K> T don​(org.drools.core.rule.consequence.Activation activation,
                                 K core,
                                 Class<T> trait,
                                 boolean b,
                                 org.drools.core.beliefsystem.Mode[] modes)
        Specified by:
        don in interface org.drools.core.common.InternalWorkingMemoryActions
      • insert

        public org.kie.api.runtime.rule.FactHandle insert​(Object object,
                                                          boolean dynamic,
                                                          org.drools.core.definitions.rule.impl.RuleImpl rule,
                                                          org.drools.core.reteoo.TerminalNode terminalNode)
        Specified by:
        insert in interface org.drools.core.common.InternalWorkingMemoryActions
      • retract

        public void retract​(org.kie.api.runtime.rule.FactHandle handle)
        Specified by:
        retract in interface org.kie.api.runtime.rule.EntryPoint
      • delete

        public void delete​(org.kie.api.runtime.rule.FactHandle handle)
        Specified by:
        delete in interface org.kie.api.runtime.rule.EntryPoint
      • delete

        public void delete​(org.kie.api.runtime.rule.FactHandle handle,
                           org.kie.api.runtime.rule.FactHandle.State fhState)
        Specified by:
        delete in interface org.kie.api.runtime.rule.EntryPoint
      • delete

        public void delete​(org.kie.api.runtime.rule.FactHandle factHandle,
                           org.drools.core.definitions.rule.impl.RuleImpl rule,
                           org.drools.core.reteoo.TerminalNode terminalNode)
        Specified by:
        delete in interface org.drools.core.WorkingMemoryEntryPoint
      • delete

        public void delete​(org.kie.api.runtime.rule.FactHandle factHandle,
                           org.drools.core.definitions.rule.impl.RuleImpl rule,
                           org.drools.core.reteoo.TerminalNode terminalNode,
                           org.kie.api.runtime.rule.FactHandle.State fhState)
        Specified by:
        delete in interface org.drools.core.WorkingMemoryEntryPoint
      • getEntryPointNode

        public org.drools.core.reteoo.EntryPointNode getEntryPointNode()
        Specified by:
        getEntryPointNode in interface org.drools.core.WorkingMemoryEntryPoint
      • update

        public void update​(org.kie.api.runtime.rule.FactHandle handle,
                           Object object)
        Specified by:
        update in interface org.kie.api.runtime.rule.EntryPoint
      • update

        public void update​(org.kie.api.runtime.rule.FactHandle handle,
                           Object object,
                           String... modifiedProperties)
        Specified by:
        update in interface org.kie.api.runtime.rule.EntryPoint
      • update

        public void update​(org.kie.api.runtime.rule.FactHandle factHandle,
                           Object object,
                           org.drools.core.util.bitmask.BitMask mask,
                           Class<?> modifiedClass,
                           org.drools.core.rule.consequence.Activation activation)
        modify is implemented as half way retract / assert due to the truth maintenance issues.
        Specified by:
        update in interface org.drools.core.common.InternalWorkingMemoryActions
        Specified by:
        update in interface org.drools.core.WorkingMemoryEntryPoint
        See Also:
        WorkingMemory
      • getNodeMemory

        public <T extends org.drools.core.common.Memory> T getNodeMemory​(org.drools.core.common.MemoryFactory<T> node)
        Retrieve the JoinMemory for a particular JoinNode.
        Specified by:
        getNodeMemory in interface org.drools.core.common.ReteEvaluator
        Parameters:
        node - The JoinNode key.
        Returns:
        The node's memory.
      • clearNodeMemory

        public void clearNodeMemory​(org.drools.core.common.MemoryFactory node)
        Specified by:
        clearNodeMemory in interface org.drools.core.common.InternalWorkingMemory
      • getNodeMemories

        public org.drools.core.common.NodeMemories getNodeMemories()
        Specified by:
        getNodeMemories in interface org.drools.core.common.InternalWorkingMemory
      • getRuleRuntimeEventSupport

        public org.drools.core.event.RuleRuntimeEventSupport getRuleRuntimeEventSupport()
        Specified by:
        getRuleRuntimeEventSupport in interface org.drools.core.common.EventSupport
        Specified by:
        getRuleRuntimeEventSupport in interface org.drools.core.common.ReteEvaluator
      • getAgendaEventSupport

        public org.drools.core.event.AgendaEventSupport getAgendaEventSupport()
        Specified by:
        getAgendaEventSupport in interface org.drools.core.common.EventSupport
      • getNextPropagationIdCounter

        public long getNextPropagationIdCounter()
        Specified by:
        getNextPropagationIdCounter in interface org.drools.core.common.ReteEvaluator
      • getLock

        public Lock getLock()
        Specified by:
        getLock in interface org.drools.core.common.InternalWorkingMemory
      • startProcess

        public org.kie.api.runtime.process.ProcessInstance startProcess​(String processId)
        Specified by:
        startProcess in interface org.kie.api.runtime.process.ProcessRuntime
        Specified by:
        startProcess in interface org.drools.core.WorkingMemory
      • startProcess

        public org.kie.api.runtime.process.ProcessInstance startProcess​(String processId,
                                                                        Map<String,​Object> parameters)
        Specified by:
        startProcess in interface org.kie.api.runtime.process.ProcessRuntime
        Specified by:
        startProcess in interface org.drools.core.WorkingMemory
      • startProcess

        public org.kie.api.runtime.process.ProcessInstance startProcess​(String processId,
                                                                        org.kie.api.runtime.rule.AgendaFilter agendaFilter)
        Specified by:
        startProcess in interface org.kie.api.runtime.process.ProcessRuntime
      • startProcess

        public org.kie.api.runtime.process.ProcessInstance startProcess​(String processId,
                                                                        Map<String,​Object> parameters,
                                                                        org.kie.api.runtime.rule.AgendaFilter agendaFilter)
        Specified by:
        startProcess in interface org.kie.api.runtime.process.ProcessRuntime
      • createProcessInstance

        public org.kie.api.runtime.process.ProcessInstance createProcessInstance​(String processId,
                                                                                 Map<String,​Object> parameters)
        Specified by:
        createProcessInstance in interface org.kie.api.runtime.process.ProcessRuntime
      • startProcessInstance

        public org.kie.api.runtime.process.ProcessInstance startProcessInstance​(String processInstanceId)
        Specified by:
        startProcessInstance in interface org.kie.api.runtime.process.ProcessRuntime
      • getProcessInstances

        public Collection<org.kie.api.runtime.process.ProcessInstance> getProcessInstances()
        Specified by:
        getProcessInstances in interface org.kie.api.runtime.process.ProcessRuntime
        Specified by:
        getProcessInstances in interface org.drools.core.WorkingMemory
      • getProcessInstance

        public org.kie.api.runtime.process.ProcessInstance getProcessInstance​(String processInstanceId)
        Specified by:
        getProcessInstance in interface org.kie.api.runtime.process.ProcessRuntime
        Specified by:
        getProcessInstance in interface org.drools.core.WorkingMemory
      • startProcess

        public org.kie.api.runtime.process.ProcessInstance startProcess​(String processId,
                                                                        org.kie.internal.process.CorrelationKey correlationKey,
                                                                        Map<String,​Object> parameters)
        Specified by:
        startProcess in interface org.kie.internal.process.CorrelationAwareProcessRuntime
      • createProcessInstance

        public org.kie.api.runtime.process.ProcessInstance createProcessInstance​(String processId,
                                                                                 org.kie.internal.process.CorrelationKey correlationKey,
                                                                                 Map<String,​Object> parameters)
        Specified by:
        createProcessInstance in interface org.kie.internal.process.CorrelationAwareProcessRuntime
      • getProcessInstance

        public org.kie.api.runtime.process.ProcessInstance getProcessInstance​(org.kie.internal.process.CorrelationKey correlationKey)
        Specified by:
        getProcessInstance in interface org.kie.internal.process.CorrelationAwareProcessRuntime
      • getProcessInstance

        public org.kie.api.runtime.process.ProcessInstance getProcessInstance​(String processInstanceId,
                                                                              boolean readOnly)
        Specified by:
        getProcessInstance in interface org.kie.api.runtime.process.ProcessRuntime
        Specified by:
        getProcessInstance in interface org.drools.core.WorkingMemory
      • getWorkItemManager

        public org.kie.api.runtime.process.WorkItemManager getWorkItemManager()
        Specified by:
        getWorkItemManager in interface org.kie.api.runtime.process.ProcessRuntime
        Specified by:
        getWorkItemManager in interface org.drools.core.WorkingMemory
      • getObjectTypeConfigurationRegistry

        public org.drools.core.common.ObjectTypeConfigurationRegistry getObjectTypeConfigurationRegistry()
        Specified by:
        getObjectTypeConfigurationRegistry in interface org.drools.core.WorkingMemoryEntryPoint
      • getInitialFactHandle

        public org.drools.core.common.InternalFactHandle getInitialFactHandle()
        Specified by:
        getInitialFactHandle in interface org.drools.core.common.InternalWorkingMemory
      • setInitialFactHandle

        public void setInitialFactHandle​(org.drools.core.common.InternalFactHandle initialFactHandle)
      • getTimerService

        public org.drools.core.time.TimerService getTimerService()
        Specified by:
        getTimerService in interface org.drools.core.common.InternalKnowledgeRuntime
        Specified by:
        getTimerService in interface org.drools.core.common.ReteEvaluator
      • createTimerService

        protected org.drools.core.time.TimerService createTimerService()
      • getSessionClock

        public org.kie.api.time.SessionClock getSessionClock()
        Specified by:
        getSessionClock in interface org.kie.api.runtime.KieRuntime
        Specified by:
        getSessionClock in interface org.drools.core.common.ReteEvaluator
      • startBatchExecution

        public void startBatchExecution()
        Specified by:
        startBatchExecution in interface org.drools.core.common.InternalWorkingMemory
      • endBatchExecution

        public void endBatchExecution()
        Specified by:
        endBatchExecution in interface org.drools.core.common.InternalWorkingMemory
      • getKnowledgeRuntime

        public org.drools.core.common.InternalKnowledgeRuntime getKnowledgeRuntime()
        Specified by:
        getKnowledgeRuntime in interface org.drools.core.common.InternalWorkingMemory
      • registerChannel

        public void registerChannel​(String name,
                                    org.kie.api.runtime.Channel channel)
        Specified by:
        registerChannel in interface org.kie.api.runtime.KieRuntime
      • unregisterChannel

        public void unregisterChannel​(String name)
        Specified by:
        unregisterChannel in interface org.kie.api.runtime.KieRuntime
      • getChannels

        public Map<String,​org.kie.api.runtime.Channel> getChannels()
        Specified by:
        getChannels in interface org.drools.core.common.InternalWorkingMemory
        Specified by:
        getChannels in interface org.kie.api.runtime.KieRuntime
      • getFactCount

        public long getFactCount()
        Specified by:
        getFactCount in interface org.kie.api.runtime.rule.EntryPoint
      • getTotalFactCount

        public long getTotalFactCount()
        Specified by:
        getTotalFactCount in interface org.drools.core.common.InternalWorkingMemory
      • startOperation

        public void startOperation()
        This method must be called before starting any new work in the engine, like inserting a new fact or firing a new rule. It will reset the engine idle time counter. This method must be extremely light to avoid contentions when called by multiple threads/entry-points
        Specified by:
        startOperation in interface org.drools.core.common.InternalKnowledgeRuntime
        Specified by:
        startOperation in interface org.drools.core.common.InternalWorkingMemory
        Specified by:
        startOperation in interface org.drools.core.common.ReteEvaluator
      • setEndOperationListener

        public void setEndOperationListener​(org.drools.core.common.EndOperationListener listener)
        Specified by:
        setEndOperationListener in interface org.drools.core.common.InternalKnowledgeRuntime
      • endOperation

        public void endOperation()
        This method must be called after finishing any work in the engine, like inserting a new fact or firing a new rule. It will reset the engine idle time counter. This method must be extremely light to avoid contentions when called by multiple threads/entry-points
        Specified by:
        endOperation in interface org.drools.core.common.InternalKnowledgeRuntime
        Specified by:
        endOperation in interface org.drools.core.common.InternalWorkingMemory
        Specified by:
        endOperation in interface org.drools.core.common.ReteEvaluator
      • getIdleTime

        public long getIdleTime()
        Returns the number of time units (usually ms) that the engine is idle according to the session clock or -1 if it is not idle. This method is not synchronised and might return an approximate value.
        Specified by:
        getIdleTime in interface org.drools.core.common.InternalWorkingMemory
      • getLastIdleTimestamp

        public long getLastIdleTimestamp()
        Specified by:
        getLastIdleTimestamp in interface org.drools.core.common.InternalKnowledgeRuntime
      • prepareToFireActivation

        public void prepareToFireActivation()
        Specified by:
        prepareToFireActivation in interface org.drools.core.common.InternalWorkingMemory
      • activationFired

        public void activationFired()
        Specified by:
        activationFired in interface org.drools.core.common.InternalWorkingMemory
      • getTimeToNextJob

        public long getTimeToNextJob()
        Returns the number of time units (usually ms) to the next scheduled job
        Specified by:
        getTimeToNextJob in interface org.drools.core.common.InternalWorkingMemory
        Returns:
        the number of time units until the next scheduled job or -1 if there is no job scheduled
      • addPropagation

        public void addPropagation​(org.drools.core.phreak.PropagationEntry propagationEntry,
                                   boolean register)
        Specified by:
        addPropagation in interface org.drools.core.common.ReteEvaluator
      • flushPropagations

        public void flushPropagations()
        Specified by:
        flushPropagations in interface org.drools.core.common.InternalWorkingMemory
      • notifyWaitOnRest

        public void notifyWaitOnRest()
        Specified by:
        notifyWaitOnRest in interface org.drools.core.common.InternalWorkingMemory
      • getActionsIterator

        public Iterator<? extends org.drools.core.phreak.PropagationEntry> getActionsIterator()
        Specified by:
        getActionsIterator in interface org.drools.core.common.InternalWorkingMemory
      • activate

        public void activate()
        Specified by:
        activate in interface org.drools.core.common.InternalWorkingMemory
      • deactivate

        public void deactivate()
        Specified by:
        deactivate in interface org.drools.core.common.InternalWorkingMemory
      • tryDeactivate

        public boolean tryDeactivate()
        Specified by:
        tryDeactivate in interface org.drools.core.common.InternalWorkingMemory
      • cancelActivation

        public void cancelActivation​(org.drools.core.rule.consequence.Activation activation,
                                     boolean declarativeAgenda)
        Specified by:
        cancelActivation in interface org.drools.core.common.InternalWorkingMemory
      • startProcessFromNodeIds

        public org.kie.api.runtime.process.ProcessInstance startProcessFromNodeIds​(String processId,
                                                                                   Map<String,​Object> params,
                                                                                   String... nodeInstancesIds)
        Specified by:
        startProcessFromNodeIds in interface org.kie.api.runtime.process.ProcessRuntime
      • startProcessFromNodeIds

        public org.kie.api.runtime.process.ProcessInstance startProcessFromNodeIds​(String processId,
                                                                                   org.kie.internal.process.CorrelationKey key,
                                                                                   Map<String,​Object> params,
                                                                                   String... nodeIds)
        Specified by:
        startProcessFromNodeIds in interface org.kie.internal.process.CorrelationAwareProcessRuntime