final Environment environment) {
if ( this.getConfig().isSequential() ) {
throw new RuntimeException( "Cannot have a stateful rule session, with sequential configuration set to true" );
}
ExecutorService executor = ExecutorServiceFactory.createExecutorService( this.getConfig().getExecutorService() );
readLock();
try {
ReteooStatefulSession session = new ReteooStatefulSession( id,
this,
executor,
sessionConfig,
environment );
session.setKnowledgeRuntime(new StatefulKnowledgeSessionImpl(session));
executor.setCommandExecutor( new CommandExecutor( session ) );
if ( sessionConfig.isKeepReference() ) {
super.addStatefulSession( session );
for (Object listener : session.getRuleBaseUpdateListeners()) {
addEventListener((RuleBaseEventListener) listener);