Package org.drools.core.common
Interface InternalWorkingMemory
-
- All Superinterfaces:
org.kie.api.runtime.rule.EntryPoint,EventSupport,org.kie.api.event.kiebase.KieBaseEventManager,ReteEvaluator,WorkingMemory,WorkingMemoryEntryPoint,WorkingMemoryEventManager
- All Known Subinterfaces:
InternalWorkingMemoryActions
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.voidcancelActivation(Activation activation, boolean declarativeAgenda)voidclearNodeMemory(MemoryFactory node)voidcloseLiveQuery(InternalFactHandle factHandle)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.Map<String,org.kie.api.runtime.Channel>getChannels()Returns a map of channel Id->Channel of all channels in this working memoryCollection<? extends org.kie.api.runtime.rule.EntryPoint>getEntryPoints()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()NodeMemoriesgetNodeMemories()InternalProcessRuntimegetProcessRuntime()default FactHandleClassStoregetStoreForClass(Class<?> clazz)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()default booleanisThreadSafe()voidnotifyWaitOnRest()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.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, getFactHandle, getFactHandles, getFactHandles, getObject, 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.common.ReteEvaluator
addPropagation, addPropagation, createFactHandle, createKnowledgeHelper, dispose, getActivationsManager, getCalendars, getDefaultEntryPoint, getDefaultEntryPointId, getEntryPoint, getFactHandle, getFactHandleFactory, getGlobal, getGlobalResolver, getKnowledgeBase, getNextPropagationIdCounter, getNodeMemory, getRuleEventSupport, getRuleRuntimeEventSupport, getSessionClock, getSessionConfiguration, getTimerJobInstances, getTimerService, insert, isSequential
-
Methods inherited from interface org.drools.core.WorkingMemory
clearActivationGroup, clearAgenda, clearAgendaGroup, clearRuleFlowGroup, fireAllRules, fireAllRules, fireAllRules, fireAllRules, getEnvironment, getProcessInstance, getProcessInstance, getProcessInstances, getQueryResults, getWorkItemManager, halt, iterateFactHandles, iterateFactHandles, iterateObjects, iterateObjects, setFocus, setGlobal, setGlobalResolver, startProcess, startProcess
-
Methods inherited from interface org.drools.core.WorkingMemoryEntryPoint
delete, delete, dispose, getEntryPoint, getEntryPointNode, getHandleFactory, getKnowledgeBase, getObjectStore, getObjectTypeConfigurationRegistry, getReteEvaluator, getRuleUnit, 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)
-
clearNodeMemory
void clearNodeMemory(MemoryFactory node)
-
getNodeMemories
NodeMemories getNodeMemories()
-
getStoreForClass
default FactHandleClassStore getStoreForClass(Class<?> clazz)
- Specified by:
getStoreForClassin interfaceReteEvaluator
-
getLock
Lock getLock()
-
getInitialFactHandle
InternalFactHandle getInitialFactHandle()
-
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()
- Specified by:
getEntryPointsin interfaceReteEvaluator
-
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- Specified by:
startOperationin interfaceReteEvaluator
-
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- Specified by:
endOperationin interfaceReteEvaluator
-
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)
-
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)
-
isThreadSafe
default boolean isThreadSafe()
- Specified by:
isThreadSafein interfaceReteEvaluator
-
-