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 voidactivate()voidactivationFired()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.voidaddPropagation(PropagationEntry propagationEntry)voidcancelActivation(Activation activation, boolean declarativeAgenda)voidclearNodeMemory(MemoryFactory node)voidcloseLiveQuery(InternalFactHandle factHandle)default KnowledgeHelpercreateKnowledgeHelper()default KnowledgeHelpercreateKnowledgeHelper(Activation activation)voiddeactivate()voidendBatchExecution()voidendOperation()This method must be called after finishing any work in the engine, like inserting a new fact or firing a new rule.voidflushPropagations()Iterator<? extends PropagationEntry>getActionsIterator()InternalAgendagetAgenda()Returns the Agenda for this WorkingMemory.org.kie.api.runtime.CalendarsgetCalendars()Map<String,org.kie.api.runtime.Channel>getChannels()Returns a map of channel Id->Channel of all channels in this working memoryEntryPointIdgetEntryPoint()org.kie.api.runtime.rule.EntryPointgetEntryPoint(String name)EntryPointNodegetEntryPointNode()Collection<? extends org.kie.api.runtime.rule.EntryPoint>getEntryPoints()org.kie.api.runtime.rule.FactHandlegetFactHandleByIdentity(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.FactHandleFactorygetFactHandleFactory()longgetIdentifier()longgetIdleTime()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.InternalFactHandlegetInitialFactHandle()InternalKnowledgeRuntimegetKnowledgeRuntime()LockgetLock()longgetNextPropagationIdCounter()NodeMemoriesgetNodeMemories()<T extends Memory>
TgetNodeMemory(MemoryFactory<T> node)ObjectStoregetObjectStore()ObjectTypeConfigurationRegistrygetObjectTypeConfigurationRegistry()InternalProcessRuntimegetProcessRuntime()default PropagationListgetPropagationList()SessionConfigurationgetSessionConfiguration()default FactHandleClassStoregetStoreForClass(Class<?> clazz)TimerServicegetTimerService()Returns the TimerService instance (session clock) for this session.longgetTimeToNextJob()Returns the number of time units (usually ms) to the next scheduled joblonggetTotalFactCount()Returns the total number of facts in the working memory, i.e., counting all facts from all entry points.InternalProcessRuntimeinternalGetProcessRuntime()booleanisSequential()voidnotifyWaitOnRest()default voidonResume()default voidonSuspend()voidprepareToFireActivation()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.voidqueueWorkingMemoryAction(WorkingMemoryAction action)voidremoveGlobal(String identifier)voidsetAgendaEventSupport(AgendaEventSupport agendaEventSupport)voidsetIdentifier(long id)voidsetRuleRuntimeEventSupport(RuleRuntimeEventSupport workingMemoryEventSupport)voidstartBatchExecution()voidstartOperation()This method must be called before starting any new work in the engine, like inserting a new fact or firing a new rule.booleantryDeactivate()voidupdateEntryPointsCache()-
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:WorkingMemoryReturns the Agenda for this WorkingMemory. While the WorkingMemory interface is considered public, the Agenda interface is more subject to change.- Specified by:
getAgendain 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:
getObjectStorein interfaceWorkingMemoryEntryPoint
-
getStoreForClass
default FactHandleClassStore getStoreForClass(Class<?> clazz)
-
queueWorkingMemoryAction
void queueWorkingMemoryAction(WorkingMemoryAction action)
-
getFactHandleFactory
FactHandleFactory getFactHandleFactory()
-
getEntryPoint
EntryPointId getEntryPoint()
- Specified by:
getEntryPointin interfaceWorkingMemoryEntryPoint
-
getEntryPointNode
EntryPointNode getEntryPointNode()
- Specified by:
getEntryPointNodein 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:
getFactHandleByIdentityin interfaceWorkingMemory- Specified by:
getFactHandleByIdentityin interfaceWorkingMemoryEntryPoint- Parameters:
object-- Returns:
- null if fact handle not found
-
getLock
Lock getLock()
-
isSequential
boolean isSequential()
-
getObjectTypeConfigurationRegistry
ObjectTypeConfigurationRegistry getObjectTypeConfigurationRegistry()
- Specified by:
getObjectTypeConfigurationRegistryin 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)
-
-