Package org.drools.core.impl
Class StatefulKnowledgeSessionImpl
- java.lang.Object
-
- org.drools.core.impl.AbstractRuntime
-
- org.drools.core.impl.StatefulKnowledgeSessionImpl
-
- All Implemented Interfaces:
Externalizable,Serializable,EventSupport,InternalKnowledgeRuntime,InternalWorkingMemory,InternalWorkingMemoryActions,WorkingMemory,WorkingMemoryEntryPoint,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 AbstractRuntime implements org.kie.internal.runtime.StatefulKnowledgeSession, WorkingMemoryEntryPoint, InternalKnowledgeRuntime, org.kie.api.runtime.KieSession, org.kie.api.event.KieRuntimeEventManager, InternalWorkingMemoryActions, EventSupport, org.kie.internal.event.rule.RuleEventManager, org.kie.api.event.process.ProcessEventManager, org.kie.internal.process.CorrelationAwareProcessRuntime, Externalizable
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classStatefulKnowledgeSessionImpl.AbstractImmutableCollectionstatic classStatefulKnowledgeSessionImpl.DummyInternalProcessRuntimestatic classStatefulKnowledgeSessionImpl.GlobalsAdapterstatic classStatefulKnowledgeSessionImpl.ObjectStoreWrapperstatic classStatefulKnowledgeSessionImpl.PartitionAwareWorkingMemoryReteExpireActionstatic classStatefulKnowledgeSessionImpl.WorkingMemoryReteAssertActionstatic classStatefulKnowledgeSessionImpl.WorkingMemoryReteExpireAction
-
Field Summary
Fields Modifier and Type Field Description protected InternalAgendaagendaRule-firing agenda.protected AgendaEventSupportagendaEventSupportbyte[]bytesprotected org.kie.api.runtime.Calendarscalendarsprotected SessionConfigurationconfigstatic StringDEFAULT_RULE_UNITprotected InternalWorkingMemoryEntryPointdefaultEntryPointstatic StatefulKnowledgeSessionImpl.DummyInternalProcessRuntimeDUMMY_PROCESS_RUNTIMEprotected Map<String,WorkingMemoryEntryPoint>entryPointsstatic StringERRORMSGprotected GlobalResolverglobalResolverGlobal values which are associated with this memory.protected FactHandleFactoryhandleFactoryprotected Longidprotected InternalFactHandleinitialFactHandleprotected InternalKnowledgeBasekBaseTheRuleBasewith which this memory is associated.protected List<org.kie.api.event.kiebase.KieBaseEventListener>kieBaseEventListenersprotected ReentrantLocklockprotected NodeMemoriesnodeMemoriesThe actual memory for theJoinNodes.protected AtomicLongpropagationIdCounterThis must be thread safe as it is incremented and read via different EntryPointsprotected RuleEventListenerSupportruleEventListenerSupportprotected RuleRuntimeEventSupportruleRuntimeEventSupportThe eventSupport-
Fields inherited from class org.drools.core.impl.AbstractRuntime
logger
-
-
Constructor Summary
Constructors Constructor Description StatefulKnowledgeSessionImpl()StatefulKnowledgeSessionImpl(long id, InternalKnowledgeBase kBase)StatefulKnowledgeSessionImpl(long id, InternalKnowledgeBase kBase, boolean initInitFactHandle, SessionConfiguration config, org.kie.api.runtime.Environment environment)StatefulKnowledgeSessionImpl(long id, InternalKnowledgeBase kBase, FactHandleFactory handleFactory, long propagationContext, SessionConfiguration config, InternalAgenda agenda, org.kie.api.runtime.Environment environment)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidabortProcessInstance(long id)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.voidaddEventListener(org.kie.api.event.kiebase.KieBaseEventListener listener)voidaddEventListener(org.kie.api.event.process.ProcessEventListener listener)voidaddEventListener(org.kie.api.event.rule.AgendaEventListener listener)Add an event listener.voidaddEventListener(org.kie.api.event.rule.RuleRuntimeEventListener listener)Add an event listener.voidaddEventListener(org.kie.internal.event.rule.RuleEventListener listener)voidaddPropagation(PropagationEntry propagationEntry)voidbindRuleBase(InternalWorkingMemory workingMemory, InternalKnowledgeBase kBase, InternalAgenda agenda, boolean initInitFactHandle)voidcancelActivation(Activation activation, boolean declarativeAgenda)protected voidcheckAlive()voidclearActivationGroup(String group)Clears the Activation Group, cancellings all its ActivationsvoidclearAgenda()Clear the Agenda.voidclearAgendaGroup(String group)Clear the Agenda Group, cancelling all its Activations.voidclearNodeMemory(MemoryFactory node)voidclearRuleFlowGroup(String group)Clears the RuleFlow group, cancelling all its ActivationsvoidcloseLiveQuery(InternalFactHandle factHandle)org.kie.api.runtime.process.ProcessInstancecreateProcessInstance(String processId, Map<String,Object> parameters)org.kie.api.runtime.process.ProcessInstancecreateProcessInstance(String processId, org.kie.internal.process.CorrelationKey correlationKey, Map<String,Object> parameters)<T> TcreateRuntimeService(Class<T> cls)protected TimerServicecreateTimerService()voiddeactivate()voiddelete(org.kie.api.runtime.rule.FactHandle handle)voiddelete(org.kie.api.runtime.rule.FactHandle factHandle, RuleImpl rule, TerminalNode terminalNode)voiddelete(org.kie.api.runtime.rule.FactHandle factHandle, RuleImpl rule, TerminalNode terminalNode, org.kie.api.runtime.rule.FactHandle.State fhState)voiddelete(org.kie.api.runtime.rule.FactHandle handle, org.kie.api.runtime.rule.FactHandle.State fhState)voiddestroy()voiddispose()Internal method called by the engine when the session is being disposed, so that the entry point can proceed with the necessary clean ups.<T,K>
Tdon(Activation activation, K core, Class<T> trait, boolean b, org.kie.api.internal.runtime.beliefs.Mode[] modes)<T,K>
Tdon(Activation activation, K core, Collection<Class<? extends Thing>> traits, boolean b, org.kie.api.internal.runtime.beliefs.Mode[] modes)voidendBatchExecution()voidendOperation()This method must be called after finishing any work in the engine, like inserting a new fact or firing a new rule.protected QueryTerminalNode[]evalQuery(String queryName, DroolsQuery queryObject, InternalFactHandle handle, PropagationContext pCtx, boolean isCalledFromRHS)<T> Texecute(org.kie.api.command.Command<T> command)voidexecuteQueuedActions()intfireAllRules()Fire all items on the agenda until empty.intfireAllRules(int fireLimit)Fire all items on the agenda until empty or at most 'fireLimit' rules have firedintfireAllRules(org.kie.api.runtime.rule.AgendaFilter agendaFilter)Fire all items on the agenda until empty, using the given AgendaFilerintfireAllRules(org.kie.api.runtime.rule.AgendaFilter agendaFilter, int fireLimit)Fire all items on the agenda using the given AgendaFiler until empty or at most 'fireLimit' rules have firedvoidfireUntilHalt()Keeps firing activations until a halt is called.voidfireUntilHalt(org.kie.api.runtime.rule.AgendaFilter agendaFilter)Keeps firing activations until a halt is called.voidflushPropagations()Iterator<? extends PropagationEntry>getActionsIterator()Map.Entry[]getActivationParameters(long activationId)MapgetActivationParameters(Activation activation)InternalAgendagetAgenda()Returns the Agenda for this WorkingMemory.Collection<org.kie.api.event.rule.AgendaEventListener>getAgendaEventListeners()Returns all event listeners.AgendaEventSupportgetAgendaEventSupport()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()WorkingMemoryEntryPointgetEntryPoint(String name)StringgetEntryPointId()Map<String,WorkingMemoryEntryPoint>getEntryPointMap()EntryPointNodegetEntryPointNode()Collection<? extends org.kie.api.runtime.rule.EntryPoint>getEntryPoints()org.kie.api.runtime.EnvironmentgetEnvironment()longgetFactCount()org.kie.api.runtime.rule.FactHandlegetFactHandle(Object object)Retrieve theFactHandleassociated with an Object.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()<T extends org.kie.api.runtime.rule.FactHandle>
Collection<T>getFactHandles()<T extends org.kie.api.runtime.rule.FactHandle>
Collection<T>getFactHandles(org.kie.api.runtime.ObjectFilter filter)ObjectgetGlobal(String identifier)Retrieve a specific instance of global data by identifierGlobalResolvergetGlobalResolver()Returns the current GlobalResolverorg.kie.api.runtime.GlobalsgetGlobals()FactHandleFactorygetHandleFactory()intgetId()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()InternalWorkingMemorygetInternalWorkingMemory()org.kie.api.KieBasegetKieBase()Collection<org.kie.api.event.kiebase.KieBaseEventListener>getKieBaseEventListeners()<T> TgetKieRuntime(Class<T> cls)InternalKnowledgeBasegetKnowledgeBase()Retrieve theRuleBasefor this working memory.InternalKnowledgeRuntimegetKnowledgeRuntime()longgetLastIdleTimestamp()LockgetLock()longgetNextPropagationIdCounter()NodeMemoriesgetNodeMemories()<T extends Memory>
TgetNodeMemory(MemoryFactory<T> node)Retrieve theJoinMemoryfor a particularJoinNode.ObjectgetObject(org.kie.api.runtime.rule.FactHandle handle)Returns the fact Object for the givenFactHandle.Collection<?>getObjects()Collection<?>getObjects(org.kie.api.runtime.ObjectFilter filter)ObjectStoregetObjectStore()ObjectTypeConfigurationRegistrygetObjectTypeConfigurationRegistry()Collection<org.kie.api.event.process.ProcessEventListener>getProcessEventListeners()org.kie.api.runtime.process.ProcessInstancegetProcessInstance(long processInstanceId)Returns the process instance with the given id.org.kie.api.runtime.process.ProcessInstancegetProcessInstance(long processInstanceId, boolean readOnly)org.kie.api.runtime.process.ProcessInstancegetProcessInstance(Object processInstanceId)org.kie.api.runtime.process.ProcessInstancegetProcessInstance(org.kie.internal.process.CorrelationKey correlationKey)Collection<org.kie.api.runtime.process.ProcessInstance>getProcessInstances()Returns the list of process instances of this working memory.InternalProcessRuntimegetProcessRuntime()longgetPropagationIdCounter()PropagationListgetPropagationList()QueryResultsImplgetQueryResults(String queryName, Object... arguments)Retrieve the QueryResults of the specified query and argumentsQueryResultsImplgetQueryResultsFromRHS(String queryName, Object... arguments)(This shall NOT be exposed on public API)RuleEventListenerSupportgetRuleEventSupport()Collection<org.kie.api.event.rule.RuleRuntimeEventListener>getRuleRuntimeEventListeners()Returns all event listeners.RuleRuntimeEventSupportgetRuleRuntimeEventSupport()org.kie.api.time.SessionClockgetSessionClock()Returns the session clock instance associated with this sessionSessionConfigurationgetSessionConfiguration()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.TruthMaintenanceSystemgetTruthMaintenanceSystem()WorkingMemoryEntryPointgetWorkingMemoryEntryPoint(String name)Returns the interface instance for a given entry point, so that the application can manage entry-point-scoped facts.Map<String,WorkingMemoryEntryPoint>getWorkingMemoryEntryPoints()org.kie.api.runtime.process.WorkItemManagergetWorkItemManager()voidhalt()Stops rule firing after the current rule finishes executingvoidinit(SessionConfiguration config, org.kie.api.runtime.Environment environment)protected voidinitDefaultEntryPoint()InternalFactHandleinitInitialFact(InternalKnowledgeBase kBase, InternalWorkingMemoryEntryPoint entryPoint, EntryPointId epId, MarshallerReaderContext context)InternalFactHandleinitInitialFact(InternalKnowledgeBase kBase, MarshallerReaderContext context)voidinitMBeans(String containerId, String kbaseName, String ksessionName)org.kie.api.runtime.rule.FactHandleinsert(Object object)org.kie.api.runtime.rule.FactHandleinsert(Object object, boolean dynamic)Insert a fact registering JavaBeanPropertyChangeListenerson the Object to automatically triggerupdatecalls ifdynamicistrue.org.kie.api.runtime.rule.FactHandleinsert(Object object, boolean dynamic, RuleImpl rule, TerminalNode terminalNode)org.kie.api.runtime.rule.FactHandleinsertAsync(Object object)InternalProcessRuntimeinternalGetProcessRuntime()protected QueryResultsImplinternalGetQueryResult(boolean calledFromRHS, String queryName, Object... arguments)booleanisAlive()booleanisSequential()Iterator<InternalFactHandle>iterateFactHandles()This class is not thread safe, changes to the working memory during iteration may give unexpected resultsIterator<InternalFactHandle>iterateFactHandles(org.kie.api.runtime.ObjectFilter filter)This class is not thread safe, changes to the working memory during iteration may give unexpected resultsListiterateNonDefaultEntryPointObjectsToList()IteratoriterateObjects()This class is not thread safe, changes to the working memory during iteration may give unexpected resultsIteratoriterateObjects(org.kie.api.runtime.ObjectFilter filter)This class is not thread safe, changes to the working memory during iteration may give unexpected resultsListiterateObjectsToList()voidnotifyWaitOnRest()org.kie.api.runtime.rule.LiveQueryopenLiveQuery(String query, Object[] arguments, org.kie.api.runtime.rule.ViewChangedEventListener listener)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)voidreadExternal(ObjectInput in)voidregisterChannel(String name, org.kie.api.runtime.Channel channel)voidremoveEventListener(org.kie.api.event.kiebase.KieBaseEventListener listener)voidremoveEventListener(org.kie.api.event.process.ProcessEventListener listener)voidremoveEventListener(org.kie.api.event.rule.AgendaEventListener listener)Remove an event listener.voidremoveEventListener(org.kie.api.event.rule.RuleRuntimeEventListener listener)Remove an event listener.voidremoveEventListener(org.kie.internal.event.rule.RuleEventListener listener)voidremoveGlobal(String identifier)voidreset()voidreset(long handleId, long handleCounter, long propagationCounter)voidretract(org.kie.api.runtime.rule.FactHandle handle)voidsetAgendaEventSupport(AgendaEventSupport agendaEventSupport)voidsetAsyncExceptionHandler(AsyncExceptionHandler handler)Sets the AsyncExceptionHandler to handle exceptions thrown by the Agenda Scheduler used for duration rules.voidsetEndOperationListener(EndOperationListener listener)voidsetFocus(String focus)Set the focus to the specified AgendaGroupvoidsetGlobal(String identifier, Object value)Set a specific instance as a global in this working memory.voidsetGlobalResolver(GlobalResolver globalResolver)Sets the GlobalResolver instance to be used when resolving globals, replaces the current GlobalResolver.voidsetHandleFactory(FactHandleFactory handleFactory)voidsetIdentifier(long id)voidsetInitialFactHandle(InternalFactHandle initialFactHandle)voidsetRuleEventListenerSupport(RuleEventListenerSupport ruleEventListenerSupport)voidsetRuleRuntimeEventSupport(RuleRuntimeEventSupport ruleRuntimeEventSupport)StatefulKnowledgeSessionImplsetStateless(boolean stateless)<T,K,X extends TraitableBean>
Thing<K>shed(Activation activation, TraitableBean<K,X> core, Class<T> trait)voidsignalEvent(String type, Object event)voidsignalEvent(String type, Object event, long processInstanceId)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.org.kie.api.runtime.process.ProcessInstancestartProcess(String processId)Starts a new process instance for the process with the given id.org.kie.api.runtime.process.ProcessInstancestartProcess(String processId, Map<String,Object> parameters)Starts a new process instance for the process with the given id.org.kie.api.runtime.process.ProcessInstancestartProcess(String processId, Map<String,Object> parameters, org.kie.api.runtime.rule.AgendaFilter agendaFilter)org.kie.api.runtime.process.ProcessInstancestartProcess(String processId, org.kie.api.runtime.rule.AgendaFilter agendaFilter)org.kie.api.runtime.process.ProcessInstancestartProcess(String processId, org.kie.internal.process.CorrelationKey correlationKey, Map<String,Object> parameters)org.kie.api.runtime.process.ProcessInstancestartProcessFromNodeIds(String processId, Map<String,Object> params, String... nodeInstancesIds)org.kie.api.runtime.process.ProcessInstancestartProcessFromNodeIds(String processId, org.kie.internal.process.CorrelationKey key, Map<String,Object> params, String... nodeIds)org.kie.api.runtime.process.ProcessInstancestartProcessInstance(long processInstanceId)voidsubmit(org.kie.api.runtime.KieSession.AtomicAction action)StringtoString()booleantryDeactivate()voidunregisterChannel(String name)voidupdate(org.kie.api.runtime.rule.FactHandle factHandle)voidupdate(org.kie.api.runtime.rule.FactHandle handle, Object object)voidupdate(org.kie.api.runtime.rule.FactHandle handle, Object object, String... modifiedProperties)voidupdate(org.kie.api.runtime.rule.FactHandle factHandle, Object object, BitMask mask, Class<?> modifiedClass, Activation activation)modify is implemented as half way retract / assert due to the truth maintenance issues.voidupdateEntryPointsCache()voidupdateTraits(InternalFactHandle h, BitMask mask, Class<?> modifiedClass, Activation activation)voidwriteExternal(ObjectOutput out)-
Methods inherited from class org.drools.core.impl.AbstractRuntime
getLogger, setLogger
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.drools.core.common.InternalWorkingMemory
createKnowledgeHelper, createKnowledgeHelper, getStoreForClass, onResume, onSuspend
-
Methods inherited from interface org.drools.core.WorkingMemoryEntryPoint
getRuleUnit, setRuleUnit
-
-
-
-
Field Detail
-
ERRORMSG
public static final String ERRORMSG
- See Also:
- Constant Field Values
-
DEFAULT_RULE_UNIT
public static final String DEFAULT_RULE_UNIT
- See Also:
- Constant Field Values
-
bytes
public byte[] bytes
-
id
protected Long id
-
nodeMemories
protected NodeMemories nodeMemories
The actual memory for theJoinNodes.
-
defaultEntryPoint
protected InternalWorkingMemoryEntryPoint defaultEntryPoint
-
globalResolver
protected GlobalResolver globalResolver
Global values which are associated with this memory.
-
calendars
protected org.kie.api.runtime.Calendars calendars
-
ruleRuntimeEventSupport
protected RuleRuntimeEventSupport ruleRuntimeEventSupport
The eventSupport
-
ruleEventListenerSupport
protected RuleEventListenerSupport ruleEventListenerSupport
-
agendaEventSupport
protected AgendaEventSupport agendaEventSupport
-
kieBaseEventListeners
protected List<org.kie.api.event.kiebase.KieBaseEventListener> kieBaseEventListeners
-
kBase
protected transient InternalKnowledgeBase kBase
TheRuleBasewith which this memory is associated.
-
handleFactory
protected FactHandleFactory handleFactory
-
agenda
protected InternalAgenda agenda
Rule-firing agenda.
-
lock
protected ReentrantLock lock
-
propagationIdCounter
protected AtomicLong propagationIdCounter
This must be thread safe as it is incremented and read via different EntryPoints
-
entryPoints
protected Map<String,WorkingMemoryEntryPoint> entryPoints
-
initialFactHandle
protected InternalFactHandle initialFactHandle
-
config
protected SessionConfiguration config
-
DUMMY_PROCESS_RUNTIME
public static final StatefulKnowledgeSessionImpl.DummyInternalProcessRuntime DUMMY_PROCESS_RUNTIME
-
-
Constructor Detail
-
StatefulKnowledgeSessionImpl
public StatefulKnowledgeSessionImpl()
-
StatefulKnowledgeSessionImpl
public StatefulKnowledgeSessionImpl(long id, InternalKnowledgeBase kBase)
-
StatefulKnowledgeSessionImpl
public StatefulKnowledgeSessionImpl(long id, InternalKnowledgeBase kBase, boolean initInitFactHandle, SessionConfiguration config, org.kie.api.runtime.Environment environment)
-
StatefulKnowledgeSessionImpl
public StatefulKnowledgeSessionImpl(long id, InternalKnowledgeBase kBase, FactHandleFactory handleFactory, long propagationContext, SessionConfiguration config, InternalAgenda agenda, org.kie.api.runtime.Environment environment)
-
-
Method Detail
-
setStateless
public StatefulKnowledgeSessionImpl setStateless(boolean stateless)
-
init
public void init(SessionConfiguration config, org.kie.api.runtime.Environment environment)
-
createTimerService
protected TimerService createTimerService()
-
bindRuleBase
public void bindRuleBase(InternalWorkingMemory workingMemory, InternalKnowledgeBase kBase, InternalAgenda agenda, boolean initInitFactHandle)
-
getTruthMaintenanceSystem
public TruthMaintenanceSystem getTruthMaintenanceSystem()
- Specified by:
getTruthMaintenanceSystemin interfaceWorkingMemoryEntryPoint
-
getHandleFactory
public FactHandleFactory getHandleFactory()
- Specified by:
getHandleFactoryin interfaceWorkingMemoryEntryPoint
-
setHandleFactory
public void setHandleFactory(FactHandleFactory handleFactory)
-
getKieRuntime
public <T> T getKieRuntime(Class<T> cls)
- Specified by:
getKieRuntimein interfaceorg.kie.api.runtime.KieSession
-
createRuntimeService
public <T> T createRuntimeService(Class<T> cls)
-
getEntryPoint
public WorkingMemoryEntryPoint getEntryPoint(String name)
- Specified by:
getEntryPointin interfaceInternalWorkingMemory- Specified by:
getEntryPointin interfaceorg.kie.api.runtime.rule.RuleRuntime
-
getEntryPoints
public Collection<? extends org.kie.api.runtime.rule.EntryPoint> getEntryPoints()
- Specified by:
getEntryPointsin interfaceInternalWorkingMemory- Specified by:
getEntryPointsin interfaceorg.kie.api.runtime.rule.RuleRuntime
-
getEntryPointMap
public Map<String,WorkingMemoryEntryPoint> getEntryPointMap()
-
getRuleRuntimeEventListeners
public Collection<org.kie.api.event.rule.RuleRuntimeEventListener> getRuleRuntimeEventListeners()
Description copied from interface:WorkingMemoryEventManagerReturns all event listeners.- Specified by:
getRuleRuntimeEventListenersin interfaceEventSupport- Specified by:
getRuleRuntimeEventListenersin interfaceorg.kie.api.event.rule.RuleRuntimeEventManager- Specified by:
getRuleRuntimeEventListenersin interfaceWorkingMemoryEventManager- Returns:
- listeners The listeners.
-
getAgendaEventListeners
public Collection<org.kie.api.event.rule.AgendaEventListener> getAgendaEventListeners()
Description copied from interface:WorkingMemoryEventManagerReturns all event listeners.- Specified by:
getAgendaEventListenersin interfaceEventSupport- Specified by:
getAgendaEventListenersin interfaceorg.kie.api.event.rule.RuleRuntimeEventManager- Specified by:
getAgendaEventListenersin interfaceWorkingMemoryEventManager- Returns:
- listeners The listeners.
-
getProcessRuntime
public InternalProcessRuntime getProcessRuntime()
- Specified by:
getProcessRuntimein interfaceInternalKnowledgeRuntime- Specified by:
getProcessRuntimein interfaceInternalWorkingMemory
-
internalGetProcessRuntime
public InternalProcessRuntime internalGetProcessRuntime()
- Specified by:
internalGetProcessRuntimein interfaceInternalWorkingMemory
-
addEventListener
public void addEventListener(org.kie.api.event.process.ProcessEventListener listener)
- Specified by:
addEventListenerin interfaceorg.kie.api.event.process.ProcessEventManager
-
getProcessEventListeners
public Collection<org.kie.api.event.process.ProcessEventListener> getProcessEventListeners()
- Specified by:
getProcessEventListenersin interfaceorg.kie.api.event.process.ProcessEventManager
-
removeEventListener
public void removeEventListener(org.kie.api.event.process.ProcessEventListener listener)
- Specified by:
removeEventListenerin interfaceorg.kie.api.event.process.ProcessEventManager
-
getKieBase
public org.kie.api.KieBase getKieBase()
- Specified by:
getKieBasein interfaceorg.kie.api.runtime.KieRuntime- Specified by:
getKieBasein interfaceorg.kie.internal.runtime.StatefulKnowledgeSession
-
dispose
public void dispose()
Description copied from interface:WorkingMemoryEntryPointInternal method called by the engine when the session is being disposed, so that the entry point can proceed with the necessary clean ups.- Specified by:
disposein interfaceorg.kie.api.runtime.KieSession- Specified by:
disposein interfaceWorkingMemoryEntryPoint
-
isAlive
public boolean isAlive()
-
destroy
public void destroy()
- Specified by:
destroyin interfaceorg.kie.api.runtime.KieSession
-
update
public void update(org.kie.api.runtime.rule.FactHandle factHandle)
-
abortProcessInstance
public void abortProcessInstance(long id)
- Specified by:
abortProcessInstancein interfaceorg.kie.api.runtime.process.ProcessRuntime
-
signalEvent
public void signalEvent(String type, Object event)
- Specified by:
signalEventin interfaceorg.kie.api.runtime.process.ProcessRuntime
-
signalEvent
public void signalEvent(String type, Object event, long processInstanceId)
- Specified by:
signalEventin interfaceorg.kie.api.runtime.process.ProcessRuntime
-
getGlobals
public org.kie.api.runtime.Globals getGlobals()
- Specified by:
getGlobalsin interfaceorg.kie.api.runtime.KieRuntime
-
getFactHandles
public <T extends org.kie.api.runtime.rule.FactHandle> Collection<T> getFactHandles()
- Specified by:
getFactHandlesin interfaceorg.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:
getFactHandlesin interfaceorg.kie.api.runtime.rule.EntryPoint
-
getObjects
public Collection<?> getObjects()
- Specified by:
getObjectsin interfaceorg.kie.api.runtime.rule.EntryPoint
-
getObjects
public Collection<?> getObjects(org.kie.api.runtime.ObjectFilter filter)
- Specified by:
getObjectsin interfaceorg.kie.api.runtime.rule.EntryPoint
-
execute
public <T> T execute(org.kie.api.command.Command<T> command)
- Specified by:
executein interfaceorg.kie.api.runtime.CommandExecutor
-
initInitialFact
public InternalFactHandle initInitialFact(InternalKnowledgeBase kBase, MarshallerReaderContext context)
-
initInitialFact
public InternalFactHandle initInitialFact(InternalKnowledgeBase kBase, InternalWorkingMemoryEntryPoint entryPoint, EntryPointId epId, MarshallerReaderContext context)
-
getEntryPointId
public String getEntryPointId()
- Specified by:
getEntryPointIdin interfaceorg.kie.api.runtime.rule.EntryPoint
-
getQueryResultsFromRHS
public QueryResultsImpl getQueryResultsFromRHS(String queryName, Object... arguments)
(This shall NOT be exposed on public API)
-
getQueryResults
public QueryResultsImpl getQueryResults(String queryName, Object... arguments)
Description copied from interface:WorkingMemoryRetrieve the QueryResults of the specified query and arguments- Specified by:
getQueryResultsin interfaceorg.kie.api.runtime.rule.RuleRuntime- Specified by:
getQueryResultsin interfaceWorkingMemory- Parameters:
queryName- The name of the query.arguments- The arguments used for the query- Returns:
- The QueryResults of the specified query. If no results match the query it is empty.
-
internalGetQueryResult
protected 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:
openLiveQueryin interfaceorg.kie.api.runtime.rule.RuleRuntime
-
evalQuery
protected QueryTerminalNode[] evalQuery(String queryName, DroolsQuery queryObject, InternalFactHandle handle, PropagationContext pCtx, boolean isCalledFromRHS)
-
closeLiveQuery
public void closeLiveQuery(InternalFactHandle factHandle)
- Specified by:
closeLiveQueryin interfaceInternalWorkingMemory
-
getEntryPoint
public EntryPointId getEntryPoint()
- Specified by:
getEntryPointin interfaceInternalWorkingMemory- Specified by:
getEntryPointin interfaceWorkingMemoryEntryPoint
-
getInternalWorkingMemory
public InternalWorkingMemory getInternalWorkingMemory()
- Specified by:
getInternalWorkingMemoryin interfaceWorkingMemoryEntryPoint
-
writeExternal
public void writeExternal(ObjectOutput out) throws IOException
- Specified by:
writeExternalin interfaceExternalizable- Throws:
IOException
-
readExternal
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
- Specified by:
readExternalin interfaceExternalizable- Throws:
IOExceptionClassNotFoundException
-
updateEntryPointsCache
public void updateEntryPointsCache()
- Specified by:
updateEntryPointsCachein interfaceInternalWorkingMemory
-
initDefaultEntryPoint
protected void initDefaultEntryPoint()
-
getSessionConfiguration
public SessionConfiguration getSessionConfiguration()
- Specified by:
getSessionConfigurationin interfaceInternalWorkingMemory- Specified by:
getSessionConfigurationin interfaceorg.kie.api.runtime.KieRuntime
-
reset
public void reset()
- Specified by:
resetin interfaceWorkingMemoryEntryPoint
-
reset
public void reset(long handleId, long handleCounter, long propagationCounter)
-
setRuleRuntimeEventSupport
public void setRuleRuntimeEventSupport(RuleRuntimeEventSupport ruleRuntimeEventSupport)
- Specified by:
setRuleRuntimeEventSupportin interfaceInternalWorkingMemory
-
setAgendaEventSupport
public void setAgendaEventSupport(AgendaEventSupport agendaEventSupport)
- Specified by:
setAgendaEventSupportin interfaceInternalWorkingMemory
-
isSequential
public boolean isSequential()
- Specified by:
isSequentialin interfaceInternalWorkingMemory
-
addEventListener
public void addEventListener(org.kie.api.event.rule.RuleRuntimeEventListener listener)
Description copied from interface:WorkingMemoryEventManagerAdd an event listener.- Specified by:
addEventListenerin interfaceorg.kie.api.event.rule.RuleRuntimeEventManager- Specified by:
addEventListenerin interfaceWorkingMemoryEventManager- Parameters:
listener- The listener to add.
-
removeEventListener
public void removeEventListener(org.kie.api.event.rule.RuleRuntimeEventListener listener)
Description copied from interface:WorkingMemoryEventManagerRemove an event listener.- Specified by:
removeEventListenerin interfaceorg.kie.api.event.rule.RuleRuntimeEventManager- Specified by:
removeEventListenerin interfaceWorkingMemoryEventManager- Parameters:
listener- The listener to remove.
-
addEventListener
public void addEventListener(org.kie.api.event.rule.AgendaEventListener listener)
Description copied from interface:WorkingMemoryEventManagerAdd an event listener.- Specified by:
addEventListenerin interfaceorg.kie.api.event.rule.RuleRuntimeEventManager- Specified by:
addEventListenerin interfaceWorkingMemoryEventManager- Parameters:
listener- The listener to add.
-
removeEventListener
public void removeEventListener(org.kie.api.event.rule.AgendaEventListener listener)
Description copied from interface:WorkingMemoryEventManagerRemove an event listener.- Specified by:
removeEventListenerin interfaceorg.kie.api.event.rule.RuleRuntimeEventManager- Specified by:
removeEventListenerin interfaceWorkingMemoryEventManager- Parameters:
listener- The listener to remove.
-
addEventListener
public void addEventListener(org.kie.api.event.kiebase.KieBaseEventListener listener)
- Specified by:
addEventListenerin interfaceorg.kie.api.event.kiebase.KieBaseEventManager
-
getKieBaseEventListeners
public Collection<org.kie.api.event.kiebase.KieBaseEventListener> getKieBaseEventListeners()
- Specified by:
getKieBaseEventListenersin interfaceorg.kie.api.event.kiebase.KieBaseEventManager
-
removeEventListener
public void removeEventListener(org.kie.api.event.kiebase.KieBaseEventListener listener)
- Specified by:
removeEventListenerin interfaceorg.kie.api.event.kiebase.KieBaseEventManager
-
getRuleEventSupport
public RuleEventListenerSupport getRuleEventSupport()
- Specified by:
getRuleEventSupportin interfaceEventSupport
-
setRuleEventListenerSupport
public void setRuleEventListenerSupport(RuleEventListenerSupport ruleEventListenerSupport)
-
addEventListener
public void addEventListener(org.kie.internal.event.rule.RuleEventListener listener)
- Specified by:
addEventListenerin interfaceorg.kie.internal.event.rule.RuleEventManager
-
removeEventListener
public void removeEventListener(org.kie.internal.event.rule.RuleEventListener listener)
- Specified by:
removeEventListenerin interfaceorg.kie.internal.event.rule.RuleEventManager
-
getFactHandleFactory
public FactHandleFactory getFactHandleFactory()
- Specified by:
getFactHandleFactoryin interfaceInternalWorkingMemory
-
setGlobal
public void setGlobal(String identifier, Object value)
Description copied from interface:WorkingMemorySet a specific instance as a global in this working memory. Null values will return doing nothing. The global identifier and its type must be declared in the drl.- Specified by:
setGlobalin interfaceorg.kie.api.runtime.KieRuntime- Specified by:
setGlobalin interfaceWorkingMemory- Parameters:
identifier- the identifier under which to populate the datavalue- the global value, cannot be null
-
removeGlobal
public void removeGlobal(String identifier)
- Specified by:
removeGlobalin interfaceInternalWorkingMemory
-
setGlobalResolver
public void setGlobalResolver(GlobalResolver globalResolver)
Description copied from interface:WorkingMemorySets the GlobalResolver instance to be used when resolving globals, replaces the current GlobalResolver. Typcicaly a delegating GlobalResolver is created that first gets a reference to the current GlobalResolver, for delegating- Specified by:
setGlobalResolverin interfaceWorkingMemory
-
getGlobalResolver
public GlobalResolver getGlobalResolver()
Description copied from interface:WorkingMemoryReturns the current GlobalResolver- Specified by:
getGlobalResolverin interfaceWorkingMemory- Returns:
-
getCalendars
public org.kie.api.runtime.Calendars getCalendars()
- Specified by:
getCalendarsin interfaceInternalWorkingMemory- Specified by:
getCalendarsin interfaceorg.kie.api.runtime.KieRuntime
-
getId
public int getId()
- Specified by:
getIdin interfaceorg.kie.api.runtime.KieSession
-
getIdentifier
public long getIdentifier()
- Specified by:
getIdentifierin interfaceInternalWorkingMemory- Specified by:
getIdentifierin interfaceorg.kie.api.runtime.KieSession
-
setIdentifier
public void setIdentifier(long id)
- Specified by:
setIdentifierin interfaceInternalKnowledgeRuntime- Specified by:
setIdentifierin interfaceInternalWorkingMemory
-
checkAlive
protected void checkAlive()
-
getGlobal
public Object getGlobal(String identifier)
Description copied from interface:WorkingMemoryRetrieve a specific instance of global data by identifier- Specified by:
getGlobalin interfaceorg.kie.api.runtime.KieRuntime- Specified by:
getGlobalin interfaceWorkingMemory- Returns:
- application data or null if nothing is set under this identifier
-
getEnvironment
public org.kie.api.runtime.Environment getEnvironment()
- Specified by:
getEnvironmentin interfaceorg.kie.api.runtime.KieRuntime- Specified by:
getEnvironmentin interfaceWorkingMemory
-
getAgenda
public 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 interfaceInternalWorkingMemory- Specified by:
getAgendain interfaceorg.kie.api.runtime.rule.RuleRuntime- Specified by:
getAgendain interfaceWorkingMemory- Returns:
- the Agenda
-
clearAgenda
public void clearAgenda()
Description copied from interface:WorkingMemoryClear the Agenda. Iterates over each AgendaGroup cancalling all Activations.- Specified by:
clearAgendain interfaceWorkingMemory
-
clearAgendaGroup
public void clearAgendaGroup(String group)
Description copied from interface:WorkingMemoryClear the Agenda Group, cancelling all its Activations.- Specified by:
clearAgendaGroupin interfaceWorkingMemory
-
clearActivationGroup
public void clearActivationGroup(String group)
Description copied from interface:WorkingMemoryClears the Activation Group, cancellings all its Activations- Specified by:
clearActivationGroupin interfaceWorkingMemory
-
clearRuleFlowGroup
public void clearRuleFlowGroup(String group)
Description copied from interface:WorkingMemoryClears the RuleFlow group, cancelling all its Activations- Specified by:
clearRuleFlowGroupin interfaceWorkingMemory
-
getKnowledgeBase
public InternalKnowledgeBase getKnowledgeBase()
Description copied from interface:WorkingMemoryRetrieve theRuleBasefor this working memory.- Specified by:
getKnowledgeBasein interfaceWorkingMemory- Specified by:
getKnowledgeBasein interfaceWorkingMemoryEntryPoint- Returns:
- The
RuleBase.
-
halt
public void halt()
Description copied from interface:WorkingMemoryStops rule firing after the current rule finishes executing- Specified by:
haltin interfaceorg.kie.api.runtime.rule.RuleRuntime- Specified by:
haltin interfaceWorkingMemory
-
fireAllRules
public int fireAllRules()
Description copied from interface:WorkingMemoryFire all items on the agenda until empty.- Specified by:
fireAllRulesin interfaceorg.kie.api.runtime.rule.StatefulRuleSession- Specified by:
fireAllRulesin interfaceWorkingMemory
-
fireAllRules
public int fireAllRules(int fireLimit)
Description copied from interface:WorkingMemoryFire all items on the agenda until empty or at most 'fireLimit' rules have fired- Specified by:
fireAllRulesin interfaceorg.kie.api.runtime.rule.StatefulRuleSession- Specified by:
fireAllRulesin interfaceWorkingMemory
-
fireAllRules
public int fireAllRules(org.kie.api.runtime.rule.AgendaFilter agendaFilter)
Description copied from interface:WorkingMemoryFire all items on the agenda until empty, using the given AgendaFiler- Specified by:
fireAllRulesin interfaceorg.kie.api.runtime.rule.StatefulRuleSession- Specified by:
fireAllRulesin interfaceWorkingMemory
-
fireAllRules
public int fireAllRules(org.kie.api.runtime.rule.AgendaFilter agendaFilter, int fireLimit)Description copied from interface:WorkingMemoryFire all items on the agenda using the given AgendaFiler until empty or at most 'fireLimit' rules have fired- Specified by:
fireAllRulesin interfaceorg.kie.api.runtime.rule.StatefulRuleSession- Specified by:
fireAllRulesin interfaceWorkingMemory
-
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:
fireUntilHaltin interfaceorg.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:
fireUntilHaltin interfaceorg.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 givenFactHandle. It actually attempts to return the value from the handle, before retrieving it from objects map.- Specified by:
getObjectin interfaceorg.kie.api.runtime.rule.EntryPoint- Specified by:
getObjectin interfaceWorkingMemory- Parameters:
handle- TheFactHandlereference for theObjectlookup- Returns:
- The associated object.
- See Also:
WorkingMemory
-
getObjectStore
public ObjectStore getObjectStore()
- Specified by:
getObjectStorein interfaceInternalWorkingMemory- Specified by:
getObjectStorein interfaceWorkingMemoryEntryPoint
-
getFactHandle
public org.kie.api.runtime.rule.FactHandle getFactHandle(Object object)
Description copied from interface:WorkingMemoryRetrieve theFactHandleassociated with an Object.- Specified by:
getFactHandlein interfaceorg.kie.api.runtime.rule.EntryPoint- Specified by:
getFactHandlein interfaceWorkingMemory- Parameters:
object- The object.- Returns:
- The associated fact handle.
- See Also:
WorkingMemory
-
getFactHandleByIdentity
public org.kie.api.runtime.rule.FactHandle getFactHandleByIdentity(Object object)
Description copied from interface:InternalWorkingMemoryLooks 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 interfaceInternalWorkingMemory- Specified by:
getFactHandleByIdentityin interfaceWorkingMemory- Specified by:
getFactHandleByIdentityin interfaceWorkingMemoryEntryPoint- Returns:
- null if fact handle not found
- 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:
iterateObjectsin interfaceWorkingMemory- Returns:
- the Iterator
-
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:
iterateObjectsin interfaceWorkingMemory- Returns:
- the Iterator
-
iterateFactHandles
public Iterator<InternalFactHandle> iterateFactHandles()
This class is not thread safe, changes to the working memory during iteration may give unexpected results- Specified by:
iterateFactHandlesin interfaceWorkingMemory- Returns:
- the Iterator
-
iterateFactHandles
public Iterator<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:
iterateFactHandlesin interfaceWorkingMemory- Returns:
- the Iterator
-
setFocus
public void setFocus(String focus)
Description copied from interface:WorkingMemorySet the focus to the specified AgendaGroup- Specified by:
setFocusin interfaceWorkingMemory
-
insertAsync
public org.kie.api.runtime.rule.FactHandle insertAsync(Object object)
- Specified by:
insertAsyncin interfaceInternalWorkingMemoryActions
-
insert
public org.kie.api.runtime.rule.FactHandle insert(Object object)
- Specified by:
insertin interfaceorg.kie.api.runtime.rule.EntryPoint- See Also:
WorkingMemory
-
insert
public org.kie.api.runtime.rule.FactHandle insert(Object object, boolean dynamic)
Description copied from interface:WorkingMemoryEntryPointInsert a fact registering JavaBeanPropertyChangeListenerson the Object to automatically triggerupdatecalls ifdynamicistrue.- Specified by:
insertin interfaceWorkingMemoryEntryPoint- Parameters:
object- The fact object.dynamic- true if Drools should add JavaBeanPropertyChangeListenersto the object.- Returns:
- The new fact-handle associated with the object.
-
submit
public void submit(org.kie.api.runtime.KieSession.AtomicAction action)
- Specified by:
submitin interfaceorg.kie.api.runtime.KieSession
-
updateTraits
public void updateTraits(InternalFactHandle h, BitMask mask, Class<?> modifiedClass, Activation activation)
- Specified by:
updateTraitsin interfaceInternalWorkingMemoryActions
-
shed
public <T,K,X extends TraitableBean> Thing<K> shed(Activation activation, TraitableBean<K,X> core, Class<T> trait)
- Specified by:
shedin interfaceInternalWorkingMemoryActions
-
don
public <T,K> T don(Activation activation, K core, Collection<Class<? extends Thing>> traits, boolean b, org.kie.api.internal.runtime.beliefs.Mode[] modes)
- Specified by:
donin interfaceInternalWorkingMemoryActions
-
don
public <T,K> T don(Activation activation, K core, Class<T> trait, boolean b, org.kie.api.internal.runtime.beliefs.Mode[] modes)
- Specified by:
donin interfaceInternalWorkingMemoryActions
-
insert
public org.kie.api.runtime.rule.FactHandle insert(Object object, boolean dynamic, RuleImpl rule, TerminalNode terminalNode)
- Specified by:
insertin interfaceInternalWorkingMemoryActions
-
retract
public void retract(org.kie.api.runtime.rule.FactHandle handle)
- Specified by:
retractin interfaceorg.kie.api.runtime.rule.EntryPoint
-
delete
public void delete(org.kie.api.runtime.rule.FactHandle handle)
- Specified by:
deletein interfaceorg.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:
deletein interfaceorg.kie.api.runtime.rule.EntryPoint
-
delete
public void delete(org.kie.api.runtime.rule.FactHandle factHandle, RuleImpl rule, TerminalNode terminalNode)- Specified by:
deletein interfaceWorkingMemoryEntryPoint
-
delete
public void delete(org.kie.api.runtime.rule.FactHandle factHandle, RuleImpl rule, TerminalNode terminalNode, org.kie.api.runtime.rule.FactHandle.State fhState)- Specified by:
deletein interfaceWorkingMemoryEntryPoint
-
getEntryPointNode
public EntryPointNode getEntryPointNode()
- Specified by:
getEntryPointNodein interfaceInternalWorkingMemory- Specified by:
getEntryPointNodein interfaceWorkingMemoryEntryPoint
-
update
public void update(org.kie.api.runtime.rule.FactHandle handle, Object object)- Specified by:
updatein interfaceorg.kie.api.runtime.rule.EntryPoint
-
update
public void update(org.kie.api.runtime.rule.FactHandle handle, Object object, String... modifiedProperties)- Specified by:
updatein interfaceorg.kie.api.runtime.rule.EntryPoint
-
update
public void update(org.kie.api.runtime.rule.FactHandle factHandle, Object object, BitMask mask, Class<?> modifiedClass, Activation activation)modify is implemented as half way retract / assert due to the truth maintenance issues.- Specified by:
updatein interfaceInternalWorkingMemoryActions- Specified by:
updatein interfaceWorkingMemoryEntryPoint- See Also:
WorkingMemory
-
executeQueuedActions
public void executeQueuedActions()
- Specified by:
executeQueuedActionsin interfaceInternalKnowledgeRuntime
-
queueWorkingMemoryAction
public void queueWorkingMemoryAction(WorkingMemoryAction action)
- Specified by:
queueWorkingMemoryActionin interfaceInternalKnowledgeRuntime- Specified by:
queueWorkingMemoryActionin interfaceInternalWorkingMemory
-
getNodeMemory
public <T extends Memory> T getNodeMemory(MemoryFactory<T> node)
Retrieve theJoinMemoryfor a particularJoinNode.- Specified by:
getNodeMemoryin interfaceInternalWorkingMemory- Parameters:
node- TheJoinNodekey.- Returns:
- The node's memory.
-
clearNodeMemory
public void clearNodeMemory(MemoryFactory node)
- Specified by:
clearNodeMemoryin interfaceInternalWorkingMemory
-
getNodeMemories
public NodeMemories getNodeMemories()
- Specified by:
getNodeMemoriesin interfaceInternalWorkingMemory
-
getRuleRuntimeEventSupport
public RuleRuntimeEventSupport getRuleRuntimeEventSupport()
- Specified by:
getRuleRuntimeEventSupportin interfaceEventSupport
-
getAgendaEventSupport
public AgendaEventSupport getAgendaEventSupport()
- Specified by:
getAgendaEventSupportin interfaceEventSupport
-
setAsyncExceptionHandler
public void setAsyncExceptionHandler(AsyncExceptionHandler handler)
Sets the AsyncExceptionHandler to handle exceptions thrown by the Agenda Scheduler used for duration rules.- Specified by:
setAsyncExceptionHandlerin interfaceWorkingMemory
-
getNextPropagationIdCounter
public long getNextPropagationIdCounter()
- Specified by:
getNextPropagationIdCounterin interfaceInternalWorkingMemory
-
getPropagationIdCounter
public long getPropagationIdCounter()
-
getLock
public Lock getLock()
- Specified by:
getLockin interfaceInternalWorkingMemory
-
startProcess
public org.kie.api.runtime.process.ProcessInstance startProcess(String processId)
Description copied from interface:WorkingMemoryStarts a new process instance for the process with the given id.- Specified by:
startProcessin interfaceorg.kie.api.runtime.process.ProcessRuntime- Specified by:
startProcessin interfaceWorkingMemory
-
startProcess
public org.kie.api.runtime.process.ProcessInstance startProcess(String processId, Map<String,Object> parameters)
Description copied from interface:WorkingMemoryStarts a new process instance for the process with the given id.- Specified by:
startProcessin interfaceorg.kie.api.runtime.process.ProcessRuntime- Specified by:
startProcessin interfaceWorkingMemory
-
startProcess
public org.kie.api.runtime.process.ProcessInstance startProcess(String processId, org.kie.api.runtime.rule.AgendaFilter agendaFilter)
- Specified by:
startProcessin interfaceorg.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:
startProcessin interfaceorg.kie.api.runtime.process.ProcessRuntime
-
createProcessInstance
public org.kie.api.runtime.process.ProcessInstance createProcessInstance(String processId, Map<String,Object> parameters)
- Specified by:
createProcessInstancein interfaceorg.kie.api.runtime.process.ProcessRuntime
-
startProcessInstance
public org.kie.api.runtime.process.ProcessInstance startProcessInstance(long processInstanceId)
- Specified by:
startProcessInstancein interfaceorg.kie.api.runtime.process.ProcessRuntime
-
getProcessInstances
public Collection<org.kie.api.runtime.process.ProcessInstance> getProcessInstances()
Description copied from interface:WorkingMemoryReturns the list of process instances of this working memory. This list is unmodifiable.- Specified by:
getProcessInstancesin interfaceorg.kie.api.runtime.process.ProcessRuntime- Specified by:
getProcessInstancesin interfaceWorkingMemory- Returns:
- the list of process instances
-
getProcessInstance
public org.kie.api.runtime.process.ProcessInstance getProcessInstance(Object processInstanceId)
-
getProcessInstance
public org.kie.api.runtime.process.ProcessInstance getProcessInstance(long processInstanceId)
Description copied from interface:WorkingMemoryReturns the process instance with the given id.- Specified by:
getProcessInstancein interfaceorg.kie.api.runtime.process.ProcessRuntime- Specified by:
getProcessInstancein interfaceWorkingMemory- Returns:
- the process instance with the given id
-
startProcess
public org.kie.api.runtime.process.ProcessInstance startProcess(String processId, org.kie.internal.process.CorrelationKey correlationKey, Map<String,Object> parameters)
- Specified by:
startProcessin interfaceorg.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:
createProcessInstancein interfaceorg.kie.internal.process.CorrelationAwareProcessRuntime
-
getProcessInstance
public org.kie.api.runtime.process.ProcessInstance getProcessInstance(org.kie.internal.process.CorrelationKey correlationKey)
- Specified by:
getProcessInstancein interfaceorg.kie.internal.process.CorrelationAwareProcessRuntime
-
getProcessInstance
public org.kie.api.runtime.process.ProcessInstance getProcessInstance(long processInstanceId, boolean readOnly)- Specified by:
getProcessInstancein interfaceorg.kie.api.runtime.process.ProcessRuntime- Specified by:
getProcessInstancein interfaceWorkingMemory
-
getWorkItemManager
public org.kie.api.runtime.process.WorkItemManager getWorkItemManager()
- Specified by:
getWorkItemManagerin interfaceorg.kie.api.runtime.process.ProcessRuntime- Specified by:
getWorkItemManagerin interfaceWorkingMemory
-
getWorkingMemoryEntryPoint
public WorkingMemoryEntryPoint getWorkingMemoryEntryPoint(String name)
Description copied from interface:WorkingMemoryReturns the interface instance for a given entry point, so that the application can manage entry-point-scoped facts.- Specified by:
getWorkingMemoryEntryPointin interfaceWorkingMemory- Specified by:
getWorkingMemoryEntryPointin interfaceWorkingMemoryEntryPoint- Parameters:
name- the id of the entry point, as defined in the rules file
-
getWorkingMemoryEntryPoints
public Map<String,WorkingMemoryEntryPoint> getWorkingMemoryEntryPoints()
-
getObjectTypeConfigurationRegistry
public ObjectTypeConfigurationRegistry getObjectTypeConfigurationRegistry()
- Specified by:
getObjectTypeConfigurationRegistryin interfaceInternalWorkingMemory- Specified by:
getObjectTypeConfigurationRegistryin interfaceWorkingMemoryEntryPoint
-
getInitialFactHandle
public InternalFactHandle getInitialFactHandle()
- Specified by:
getInitialFactHandlein interfaceInternalWorkingMemory
-
setInitialFactHandle
public void setInitialFactHandle(InternalFactHandle initialFactHandle)
-
getTimerService
public TimerService getTimerService()
Description copied from interface:InternalWorkingMemoryReturns the TimerService instance (session clock) for this session.- Specified by:
getTimerServicein interfaceInternalKnowledgeRuntime- Specified by:
getTimerServicein interfaceInternalWorkingMemory- Returns:
-
getSessionClock
public org.kie.api.time.SessionClock getSessionClock()
Description copied from interface:WorkingMemoryReturns the session clock instance associated with this session- Specified by:
getSessionClockin interfaceorg.kie.api.runtime.KieRuntime- Specified by:
getSessionClockin interfaceWorkingMemory- Returns:
-
startBatchExecution
public void startBatchExecution()
- Specified by:
startBatchExecutionin interfaceInternalWorkingMemory
-
endBatchExecution
public void endBatchExecution()
- Specified by:
endBatchExecutionin interfaceInternalWorkingMemory
-
getKnowledgeRuntime
public InternalKnowledgeRuntime getKnowledgeRuntime()
- Specified by:
getKnowledgeRuntimein interfaceInternalWorkingMemory
-
registerChannel
public void registerChannel(String name, org.kie.api.runtime.Channel channel)
- Specified by:
registerChannelin interfaceorg.kie.api.runtime.KieRuntime
-
unregisterChannel
public void unregisterChannel(String name)
- Specified by:
unregisterChannelin interfaceorg.kie.api.runtime.KieRuntime
-
getChannels
public Map<String,org.kie.api.runtime.Channel> getChannels()
Description copied from interface:InternalWorkingMemoryReturns a map of channel Id->Channel of all channels in this working memory- Specified by:
getChannelsin interfaceInternalWorkingMemory- Specified by:
getChannelsin interfaceorg.kie.api.runtime.KieRuntime- Returns:
-
getFactCount
public long getFactCount()
- Specified by:
getFactCountin interfaceorg.kie.api.runtime.rule.EntryPoint
-
getTotalFactCount
public long getTotalFactCount()
Description copied from interface:InternalWorkingMemoryReturns 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.- Specified by:
getTotalFactCountin interfaceInternalWorkingMemory- Returns:
-
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:
startOperationin interfaceInternalKnowledgeRuntime- Specified by:
startOperationin interfaceInternalWorkingMemory
-
setEndOperationListener
public void setEndOperationListener(EndOperationListener listener)
- Specified by:
setEndOperationListenerin interfaceInternalKnowledgeRuntime
-
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:
endOperationin interfaceInternalKnowledgeRuntime- Specified by:
endOperationin interfaceInternalWorkingMemory
-
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:
getIdleTimein interfaceInternalWorkingMemory- Returns:
-
getLastIdleTimestamp
public long getLastIdleTimestamp()
- Specified by:
getLastIdleTimestampin interfaceInternalKnowledgeRuntime
-
prepareToFireActivation
public void prepareToFireActivation()
Description copied from interface:InternalWorkingMemoryThis 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.- Specified by:
prepareToFireActivationin interfaceInternalWorkingMemory
-
activationFired
public void activationFired()
Description copied from interface:InternalWorkingMemoryThis 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.- Specified by:
activationFiredin interfaceInternalWorkingMemory
-
getTimeToNextJob
public long getTimeToNextJob()
Returns the number of time units (usually ms) to the next scheduled job- Specified by:
getTimeToNextJobin interfaceInternalWorkingMemory- Returns:
- the number of time units until the next scheduled job or -1 if there is no job scheduled
-
addPropagation
public void addPropagation(PropagationEntry propagationEntry)
- Specified by:
addPropagationin interfaceInternalWorkingMemory
-
flushPropagations
public void flushPropagations()
- Specified by:
flushPropagationsin interfaceInternalWorkingMemory
-
notifyWaitOnRest
public void notifyWaitOnRest()
- Specified by:
notifyWaitOnRestin interfaceInternalWorkingMemory
-
getActionsIterator
public Iterator<? extends PropagationEntry> getActionsIterator()
- Specified by:
getActionsIteratorin interfaceInternalWorkingMemory
-
activate
public void activate()
- Specified by:
activatein interfaceInternalWorkingMemory
-
deactivate
public void deactivate()
- Specified by:
deactivatein interfaceInternalWorkingMemory
-
tryDeactivate
public boolean tryDeactivate()
- Specified by:
tryDeactivatein interfaceInternalWorkingMemory
-
cancelActivation
public void cancelActivation(Activation activation, boolean declarativeAgenda)
- Specified by:
cancelActivationin interfaceInternalWorkingMemory
-
getPropagationList
public PropagationList getPropagationList()
- Specified by:
getPropagationListin interfaceInternalWorkingMemory
-
iterateObjectsToList
public List iterateObjectsToList()
-
iterateNonDefaultEntryPointObjectsToList
public List iterateNonDefaultEntryPointObjectsToList()
-
getActivationParameters
public Map.Entry[] getActivationParameters(long activationId)
-
getActivationParameters
public Map getActivationParameters(Activation activation)
-
startProcessFromNodeIds
public org.kie.api.runtime.process.ProcessInstance startProcessFromNodeIds(String processId, Map<String,Object> params, String... nodeInstancesIds)
- Specified by:
startProcessFromNodeIdsin interfaceorg.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:
startProcessFromNodeIdsin interfaceorg.kie.internal.process.CorrelationAwareProcessRuntime
-
-