org.drools
Interface StatefulSession

All Superinterfaces:
RuleBaseEventManager, WorkingMemory, org.drools.runtime.rule.WorkingMemoryEntryPoint, WorkingMemoryEventManager
All Known Implementing Classes:
ReteooStatefulSession

public interface StatefulSession
extends WorkingMemory

A stateful session represents a working memory which keeps state between invocations (accumulating facts/knowledge). Caution should be used when using the async methods (take note of the javadocs for specific methods). IMPORTANT: Remember to call dispose() when finished with this session.


Method Summary
 Future asyncFireAllRules()
          This will initiate the firing phase (in the background).
 Future asyncFireAllRules(AgendaFilter agendaFilter)
          This will initiate the firing phase (in the background).
 Future asyncInsert(Collection collect)
          Insert/Assert a collect of objects..
 Future asyncInsert(Object object)
          Insert/Assert an object asynchronously.
 Future asyncInsert(Object[] array)
          Insert/Assert an array of objects..
 Future asyncRetract(FactHandle factHandle)
           
 Future asyncUpdate(FactHandle factHandle, Object object)
           
 void dispose()
          Forces the workingMemory to be disconnected from the rulebase (not calling this may cause resource leaks).
 void fireUntilHalt()
          Keeps firing activations until a halt is called.
 void fireUntilHalt(AgendaFilter agendaFilter)
          Keeps firing activations until a halt is called.
 List getRuleBaseUpdateListeners()
           
 
Methods inherited from interface org.drools.WorkingMemory
clearActivationGroup, clearAgenda, clearAgendaGroup, clearRuleFlowGroup, fireAllRules, fireAllRules, fireAllRules, fireAllRules, getAgenda, getEnvironment, getFactHandle, getFactHandleByIdentity, getGlobal, getGlobalResolver, getObject, getProcessInstance, getProcessInstances, getQueryResults, getRuleBase, getSessionClock, getWorkingMemoryEntryPoint, getWorkItemManager, halt, iterateFactHandles, iterateFactHandles, iterateObjects, iterateObjects, setAsyncExceptionHandler, setFocus, setGlobal, setGlobalResolver, startProcess, startProcess
 
Methods inherited from interface org.drools.WorkingMemoryEventManager
addEventListener, addEventListener, getAgendaEventListeners, getWorkingMemoryEventListeners, removeEventListener, removeEventListener
 
Methods inherited from interface org.drools.RuleBaseEventManager
addEventListener, getRuleBaseEventListeners, removeEventListener
 
Methods inherited from interface org.drools.WorkingMemoryEntryPoint
insert, insert, retract, update
 
Methods inherited from interface org.drools.runtime.rule.WorkingMemoryEntryPoint
getEntryPointId, getFactCount, getFactHandles, getFactHandles, getObjects, getObjects
 

Method Detail

dispose

void dispose()
Forces the workingMemory to be disconnected from the rulebase (not calling this may cause resource leaks).


asyncInsert

Future asyncInsert(Object object)
Insert/Assert an object asynchronously. (return immediately, even while the insertion is taking effect). The returned Future object can be queried to check on the status of the task. You should only use the async methods if you are sure you require a background insertion task to take effect (a new thread may be created). If you are not sure, then you probably don't need to use it !


asyncRetract

Future asyncRetract(FactHandle factHandle)

asyncUpdate

Future asyncUpdate(FactHandle factHandle,
                   Object object)

asyncInsert

Future asyncInsert(Object[] array)
Insert/Assert an array of objects.. (return immediately, even while the insertion is taking effect). The returned Future object can be queried to check on the status of the task. You should only use the async methods if you are sure you require a background insertion task to take effect (a new thread may be created). If you are not sure, then you probably don't need to use it !


asyncInsert

Future asyncInsert(Collection collect)
Insert/Assert a collect of objects.. (return immediately, even while the insertion is taking effect). The returned Future object can be queried to check on the status of the task. You should only use the async methods if you are sure you require a background insertion task to take effect (a new thread may be created). If you are not sure, then you probably don't need to use it !


asyncFireAllRules

Future asyncFireAllRules()
This will initiate the firing phase (in the background). And return immediately. The returned Future object can be queried to check on the status of the task.


asyncFireAllRules

Future asyncFireAllRules(AgendaFilter agendaFilter)
This will initiate the firing phase (in the background). And return immediately. The returned Future object can be queried to check on the status of the task.


getRuleBaseUpdateListeners

List getRuleBaseUpdateListeners()

fireUntilHalt

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.

Throws:
IllegalStateException - if this method is called when running in sequential mode

fireUntilHalt

void fireUntilHalt(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.

Parameters:
agendaFilter - filters the activations that may fire
Throws:
IllegalStateException - if this method is called when running in sequential mode


Copyright © 2001-2012 JBoss by Red Hat. All Rights Reserved.