Package org.drools.core.common
Interface InternalWorkingMemory
-
- All Superinterfaces:
org.kie.api.runtime.rule.EntryPoint
,EventSupport
,org.kie.api.event.kiebase.KieBaseEventManager
,WorkingMemory
,WorkingMemoryEntryPoint
,WorkingMemoryEventManager
- All Known Subinterfaces:
InternalWorkingMemoryActions
- All Known Implementing Classes:
StatefulKnowledgeSessionImpl
,WrappedStatefulKnowledgeSessionForRHS
public interface InternalWorkingMemory extends WorkingMemory, WorkingMemoryEntryPoint, EventSupport
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description void
activate()
void
activationFired()
This method is called by the agenda right after an activation was fired to allow the working memory to resume any activities blocked during activation firing.void
addPropagation(PropagationEntry propagationEntry)
void
cancelActivation(Activation activation, boolean declarativeAgenda)
void
clearNodeMemory(MemoryFactory node)
void
closeLiveQuery(InternalFactHandle factHandle)
default KnowledgeHelper
createKnowledgeHelper()
default KnowledgeHelper
createKnowledgeHelper(Activation activation)
void
deactivate()
void
endBatchExecution()
void
endOperation()
This method must be called after finishing any work in the engine, like inserting a new fact or firing a new rule.void
flushPropagations()
Iterator<? extends PropagationEntry>
getActionsIterator()
InternalAgenda
getAgenda()
Returns the Agenda for this WorkingMemory.org.kie.api.runtime.Calendars
getCalendars()
Map<String,org.kie.api.runtime.Channel>
getChannels()
Returns a map of channel Id->Channel of all channels in this working memoryEntryPointId
getEntryPoint()
org.kie.api.runtime.rule.EntryPoint
getEntryPoint(String name)
EntryPointNode
getEntryPointNode()
Collection<? extends org.kie.api.runtime.rule.EntryPoint>
getEntryPoints()
org.kie.api.runtime.rule.FactHandle
getFactHandleByIdentity(Object object)
Looks for the fact handle associated to the given object by looking up the object IDENTITY (==), even if rule base is configured to AssertBehavior.EQUALITY.FactHandleFactory
getFactHandleFactory()
long
getIdentifier()
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.InternalFactHandle
getInitialFactHandle()
InternalKnowledgeRuntime
getKnowledgeRuntime()
Lock
getLock()
long
getNextPropagationIdCounter()
NodeMemories
getNodeMemories()
<T extends Memory>
TgetNodeMemory(MemoryFactory<T> node)
ObjectStore
getObjectStore()
ObjectTypeConfigurationRegistry
getObjectTypeConfigurationRegistry()
InternalProcessRuntime
getProcessRuntime()
default PropagationList
getPropagationList()
SessionConfiguration
getSessionConfiguration()
default FactHandleClassStore
getStoreForClass(Class<?> clazz)
TimerService
getTimerService()
Returns the TimerService instance (session clock) for this session.long
getTimeToNextJob()
Returns the number of time units (usually ms) to the next scheduled joblong
getTotalFactCount()
Returns the total number of facts in the working memory, i.e., counting all facts from all entry points.InternalProcessRuntime
internalGetProcessRuntime()
boolean
isSequential()
void
notifyWaitOnRest()
default void
onResume()
default void
onSuspend()
void
prepareToFireActivation()
This method is called by the agenda before firing a new activation to ensure the working memory is in a safe state to fire the activation.void
queueWorkingMemoryAction(WorkingMemoryAction action)
void
removeGlobal(String identifier)
void
setAgendaEventSupport(AgendaEventSupport agendaEventSupport)
void
setIdentifier(long id)
void
setRuleRuntimeEventSupport(RuleRuntimeEventSupport workingMemoryEventSupport)
void
startBatchExecution()
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.boolean
tryDeactivate()
void
updateEntryPointsCache()
-
Methods inherited from interface org.kie.api.runtime.rule.EntryPoint
delete, delete, getEntryPointId, getFactCount, getFactHandles, getFactHandles, getObjects, getObjects, insert, retract, update, update
-
Methods inherited from interface org.drools.core.common.EventSupport
getAgendaEventListeners, getAgendaEventSupport, getRuleEventSupport, getRuleRuntimeEventListeners, getRuleRuntimeEventSupport
-
Methods inherited from interface org.kie.api.event.kiebase.KieBaseEventManager
addEventListener, getKieBaseEventListeners, removeEventListener
-
Methods inherited from interface org.drools.core.WorkingMemory
clearActivationGroup, clearAgenda, clearAgendaGroup, clearRuleFlowGroup, fireAllRules, fireAllRules, fireAllRules, fireAllRules, getEnvironment, getFactHandle, getGlobal, getGlobalResolver, getKnowledgeBase, getObject, getProcessInstance, getProcessInstance, getProcessInstances, getQueryResults, getSessionClock, getWorkingMemoryEntryPoint, getWorkItemManager, halt, iterateFactHandles, iterateFactHandles, iterateObjects, iterateObjects, setAsyncExceptionHandler, setFocus, setGlobal, setGlobalResolver, startProcess, startProcess
-
Methods inherited from interface org.drools.core.WorkingMemoryEntryPoint
delete, delete, dispose, getHandleFactory, getInternalWorkingMemory, getRuleUnit, getTruthMaintenanceSystem, insert, reset, setRuleUnit, update
-
Methods inherited from interface org.drools.core.WorkingMemoryEventManager
addEventListener, addEventListener, getAgendaEventListeners, getRuleRuntimeEventListeners, removeEventListener, removeEventListener
-
-
-
-
Method Detail
-
getAgenda
InternalAgenda getAgenda()
Description copied from interface:WorkingMemory
Returns the Agenda for this WorkingMemory. While the WorkingMemory interface is considered public, the Agenda interface is more subject to change.- Specified by:
getAgenda
in interfaceWorkingMemory
- Returns:
- the Agenda
-
getIdentifier
long getIdentifier()
-
setIdentifier
void setIdentifier(long id)
-
setRuleRuntimeEventSupport
void setRuleRuntimeEventSupport(RuleRuntimeEventSupport workingMemoryEventSupport)
-
setAgendaEventSupport
void setAgendaEventSupport(AgendaEventSupport agendaEventSupport)
-
getNodeMemory
<T extends Memory> T getNodeMemory(MemoryFactory<T> node)
-
clearNodeMemory
void clearNodeMemory(MemoryFactory node)
-
getNodeMemories
NodeMemories getNodeMemories()
-
getNextPropagationIdCounter
long getNextPropagationIdCounter()
-
getObjectStore
ObjectStore getObjectStore()
- Specified by:
getObjectStore
in interfaceWorkingMemoryEntryPoint
-
getStoreForClass
default FactHandleClassStore getStoreForClass(Class<?> clazz)
-
queueWorkingMemoryAction
void queueWorkingMemoryAction(WorkingMemoryAction action)
-
getFactHandleFactory
FactHandleFactory getFactHandleFactory()
-
getEntryPoint
EntryPointId getEntryPoint()
- Specified by:
getEntryPoint
in interfaceWorkingMemoryEntryPoint
-
getEntryPointNode
EntryPointNode getEntryPointNode()
- Specified by:
getEntryPointNode
in interfaceWorkingMemoryEntryPoint
-
getEntryPoint
org.kie.api.runtime.rule.EntryPoint getEntryPoint(String name)
-
getFactHandleByIdentity
org.kie.api.runtime.rule.FactHandle getFactHandleByIdentity(Object object)
Looks for the fact handle associated to the given object by looking up the object IDENTITY (==), even if rule base is configured to AssertBehavior.EQUALITY.- Specified by:
getFactHandleByIdentity
in interfaceWorkingMemory
- Specified by:
getFactHandleByIdentity
in interfaceWorkingMemoryEntryPoint
- Parameters:
object
-- Returns:
- null if fact handle not found
-
getLock
Lock getLock()
-
isSequential
boolean isSequential()
-
getObjectTypeConfigurationRegistry
ObjectTypeConfigurationRegistry getObjectTypeConfigurationRegistry()
- Specified by:
getObjectTypeConfigurationRegistry
in interfaceWorkingMemoryEntryPoint
-
getInitialFactHandle
InternalFactHandle getInitialFactHandle()
-
getCalendars
org.kie.api.runtime.Calendars getCalendars()
-
getTimerService
TimerService getTimerService()
Returns the TimerService instance (session clock) for this session.- Returns:
-
getKnowledgeRuntime
InternalKnowledgeRuntime getKnowledgeRuntime()
-
getChannels
Map<String,org.kie.api.runtime.Channel> getChannels()
Returns a map of channel Id->Channel of all channels in this working memory- Returns:
-
getEntryPoints
Collection<? extends org.kie.api.runtime.rule.EntryPoint> getEntryPoints()
-
getSessionConfiguration
SessionConfiguration getSessionConfiguration()
-
startBatchExecution
void startBatchExecution()
-
endBatchExecution
void endBatchExecution()
-
startOperation
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
-
endOperation
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
-
getIdleTime
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.- Returns:
-
getTimeToNextJob
long getTimeToNextJob()
Returns the number of time units (usually ms) to the next scheduled job- Returns:
- the number of time units until the next scheduled job or -1 if there is no job scheduled
-
updateEntryPointsCache
void updateEntryPointsCache()
-
prepareToFireActivation
void prepareToFireActivation()
This method is called by the agenda before firing a new activation to ensure the working memory is in a safe state to fire the activation.
-
activationFired
void activationFired()
This method is called by the agenda right after an activation was fired to allow the working memory to resume any activities blocked during activation firing.
-
getTotalFactCount
long getTotalFactCount()
Returns the total number of facts in the working memory, i.e., counting all facts from all entry points. This is an approximate value and may not be accurate due to the concurrent nature of the entry points.- Returns:
-
getProcessRuntime
InternalProcessRuntime getProcessRuntime()
-
internalGetProcessRuntime
InternalProcessRuntime internalGetProcessRuntime()
-
closeLiveQuery
void closeLiveQuery(InternalFactHandle factHandle)
-
addPropagation
void addPropagation(PropagationEntry propagationEntry)
-
flushPropagations
void flushPropagations()
-
activate
void activate()
-
deactivate
void deactivate()
-
tryDeactivate
boolean tryDeactivate()
-
getActionsIterator
Iterator<? extends PropagationEntry> getActionsIterator()
-
removeGlobal
void removeGlobal(String identifier)
-
notifyWaitOnRest
void notifyWaitOnRest()
-
cancelActivation
void cancelActivation(Activation activation, boolean declarativeAgenda)
-
getPropagationList
default PropagationList getPropagationList()
-
onSuspend
default void onSuspend()
-
onResume
default void onResume()
-
createKnowledgeHelper
default KnowledgeHelper createKnowledgeHelper()
-
createKnowledgeHelper
default KnowledgeHelper createKnowledgeHelper(Activation activation)
-
-