Search in sources :

Example 1 with FactHandleFactory

use of org.drools.core.spi.FactHandleFactory 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;
}
Also used : InternalAgenda(org.drools.core.common.InternalAgenda) StatefulKnowledgeSessionImpl(org.drools.core.impl.StatefulKnowledgeSessionImpl) WorkingMemoryFactory(org.drools.core.common.WorkingMemoryFactory) FactHandleFactory(org.drools.core.spi.FactHandleFactory)

Example 2 with FactHandleFactory

use of org.drools.core.spi.FactHandleFactory in project drools by kiegroup.

the class CursoredDataSource method insertIntoWm.

private FactHandle insertIntoWm(T object) {
    FactHandleFactory fhFactory = workingMemory.getFactHandleFactory();
    DataSourceFactHandle factHandle = new DataSourceFactHandle(this, fhFactory.getNextId(), fhFactory.getNextRecency(), object);
    objectStore.addHandle(factHandle, object);
    propagate(() -> new Insert(factHandle));
    return factHandle;
}
Also used : FactHandleFactory(org.drools.core.spi.FactHandleFactory)

Aggregations

FactHandleFactory (org.drools.core.spi.FactHandleFactory)2 InternalAgenda (org.drools.core.common.InternalAgenda)1 WorkingMemoryFactory (org.drools.core.common.WorkingMemoryFactory)1 StatefulKnowledgeSessionImpl (org.drools.core.impl.StatefulKnowledgeSessionImpl)1