DefaultAgenda agenda = new DefaultAgenda( context.ruleBase,
false );
readAgenda( context,
agenda );
ReteooStatefulSession session = new ReteooStatefulSession( id,
context.ruleBase,
executor,
handleFactory,
initialFactHandle,
propagationCounter,
config,
agenda,
environment );
// RuleFlowGroups need to reference the session
for ( RuleFlowGroup group : agenda.getRuleFlowGroupsMap().values() ) {
((RuleFlowGroupImpl) group).setWorkingMemory( session );
}
context.wm = session;
readFactHandles( context );
readActionQueue( context );
if ( context.readBoolean() ) {
readTruthMaintenanceSystem( context );
}
if ( context.marshalProcessInstances ) {
readProcessInstances( context );
}
if ( context.marshalWorkItems ) {
readWorkItems( context );
}
readTimers( context );
if( multithread ) {
session.startPartitionManagers();
}
return session;
}