Search in sources :

Example 1 with CommandServiceTimerJobFactoryManager

use of org.drools.core.time.impl.CommandServiceTimerJobFactoryManager in project drools by kiegroup.

the class PersistableRunner method initNewKnowledgeSession.

protected void initNewKnowledgeSession(KieBase kbase, KieSessionConfiguration conf) {
    this.sessionInfo = new SessionInfo();
    // create session but bypass command service
    this.ksession = kbase.newKieSession(conf, this.env);
    initKieSessionMBeans(this.ksession);
    this.marshallingHelper = new SessionMarshallingHelper(this.ksession, conf);
    MarshallingConfigurationImpl config = (MarshallingConfigurationImpl) this.marshallingHelper.getMarshaller().getMarshallingConfiguration();
    config.setMarshallProcessInstances(false);
    config.setMarshallWorkItems(false);
    this.sessionInfo.setJPASessionMashallingHelper(this.marshallingHelper);
    ((InternalKnowledgeRuntime) this.ksession).setEndOperationListener(new EndOperationListenerImpl(this.txm, this.sessionInfo));
    this.runner = new TransactionInterceptor();
    TimerJobFactoryManager timerJobFactoryManager = ((InternalKnowledgeRuntime) ksession).getTimerService().getTimerJobFactoryManager();
    if (timerJobFactoryManager instanceof CommandServiceTimerJobFactoryManager) {
        ((CommandServiceTimerJobFactoryManager) timerJobFactoryManager).setRunner(this);
    }
}
Also used : InternalKnowledgeRuntime(org.drools.core.common.InternalKnowledgeRuntime) MarshallingConfigurationImpl(org.drools.core.marshalling.impl.MarshallingConfigurationImpl) CommandServiceTimerJobFactoryManager(org.drools.core.time.impl.CommandServiceTimerJobFactoryManager) TimerJobFactoryManager(org.drools.core.time.impl.TimerJobFactoryManager) CommandServiceTimerJobFactoryManager(org.drools.core.time.impl.CommandServiceTimerJobFactoryManager) SessionInfo(org.drools.persistence.info.SessionInfo) SessionMarshallingHelper(org.drools.persistence.api.SessionMarshallingHelper)

Example 2 with CommandServiceTimerJobFactoryManager

use of org.drools.core.time.impl.CommandServiceTimerJobFactoryManager in project drools by kiegroup.

the class JpaTimerJobInstance method call.

public Void call() throws Exception {
    try {
        JDKCallableJobCommand command = new JDKCallableJobCommand(this);
        ExecutableRunner runner = ((CommandServiceTimerJobFactoryManager) ((TimerService) scheduler).getTimerJobFactoryManager()).getRunner();
        runner.execute(command);
        return null;
    } catch (Exception e) {
        logger.error("Unable to execute timer job!", e);
        throw e;
    }
}
Also used : CommandServiceTimerJobFactoryManager(org.drools.core.time.impl.CommandServiceTimerJobFactoryManager) ExecutableRunner(org.kie.api.runtime.ExecutableRunner)

Aggregations

CommandServiceTimerJobFactoryManager (org.drools.core.time.impl.CommandServiceTimerJobFactoryManager)2 InternalKnowledgeRuntime (org.drools.core.common.InternalKnowledgeRuntime)1 MarshallingConfigurationImpl (org.drools.core.marshalling.impl.MarshallingConfigurationImpl)1 TimerJobFactoryManager (org.drools.core.time.impl.TimerJobFactoryManager)1 SessionMarshallingHelper (org.drools.persistence.api.SessionMarshallingHelper)1 SessionInfo (org.drools.persistence.info.SessionInfo)1 ExecutableRunner (org.kie.api.runtime.ExecutableRunner)1