use of org.drools.core.common.WorkingMemoryFactory in project drools by kiegroup.
the class KnowledgeBaseImpl method newKieSession.
public KieSession newKieSession(KieSessionConfiguration conf, Environment environment) {
// NOTE if you update here, you'll also need to update the JPAService
if (conf == null) {
conf = getSessionConfiguration();
}
SessionConfiguration sessionConfig = (SessionConfiguration) conf;
if (environment == null) {
environment = EnvironmentFactory.newEnvironment();
}
if (this.getConfiguration().isSequential()) {
throw new RuntimeException("Cannot have a stateful rule session, with sequential configuration set to true");
}
readLock();
try {
WorkingMemoryFactory wmFactory = kieComponentFactory.getWorkingMemoryFactory();
StatefulKnowledgeSessionImpl session = (StatefulKnowledgeSessionImpl) wmFactory.createWorkingMemory(nextWorkingMemoryCounter(), this, sessionConfig, environment);
if (sessionConfig.isKeepReference()) {
addStatefulSession(session);
}
return session;
} finally {
readUnlock();
}
}
use of org.drools.core.common.WorkingMemoryFactory in project drools by kiegroup.
the class ProtobufInputMarshaller method createAndInitializeSession.
private static StatefulKnowledgeSessionImpl createAndInitializeSession(MarshallerReaderContext context, int id, Environment environment, SessionConfiguration config, ProtobufMessages.KnowledgeSession _session) throws IOException {
FactHandleFactory handleFactory = context.kBase.newFactHandleFactory(_session.getRuleData().getLastId(), _session.getRuleData().getLastRecency());
InternalAgenda agenda = context.kBase.getConfiguration().getComponentFactory().getAgendaFactory().createAgenda(context.kBase, false);
readAgenda(context, _session.getRuleData(), agenda);
WorkingMemoryFactory wmFactory = context.kBase.getConfiguration().getComponentFactory().getWorkingMemoryFactory();
StatefulKnowledgeSessionImpl session = (StatefulKnowledgeSessionImpl) wmFactory.createWorkingMemory(id, context.kBase, handleFactory, // pCTx starts at 1, as InitialFact is 0
1, config, agenda, environment);
return session;
}
Aggregations