Search in sources :

Example 1 with TransactionAwareSchedulerServiceInterceptor

use of org.jbpm.runtime.manager.impl.tx.TransactionAwareSchedulerServiceInterceptor in project jbpm by kiegroup.

the class RuntimeManagerFactoryImpl method initTimerService.

protected void initTimerService(RuntimeEnvironment environment, RuntimeManager manager) {
    if (environment instanceof SchedulerProvider) {
        GlobalSchedulerService schedulerService = ((SchedulerProvider) environment).getSchedulerService();
        if (schedulerService != null) {
            TimerService globalTs = new GlobalTimerService(manager, schedulerService);
            String timerServiceId = manager.getIdentifier() + TimerServiceRegistry.TIMER_SERVICE_SUFFIX;
            // and register it in the registry under 'default' key
            TimerServiceRegistry.getInstance().registerTimerService(timerServiceId, globalTs);
            ((SimpleRuntimeEnvironment) environment).addToConfiguration("drools.timerService", "new org.jbpm.process.core.timer.impl.RegisteredTimerServiceDelegate(\"" + timerServiceId + "\")");
            if (!schedulerService.isTransactional()) {
                schedulerService.setInterceptor(new TransactionAwareSchedulerServiceInterceptor(environment, manager, schedulerService));
            }
        }
    }
}
Also used : GlobalSchedulerService(org.jbpm.process.core.timer.GlobalSchedulerService) SchedulerProvider(org.jbpm.runtime.manager.api.SchedulerProvider) TransactionAwareSchedulerServiceInterceptor(org.jbpm.runtime.manager.impl.tx.TransactionAwareSchedulerServiceInterceptor) GlobalTimerService(org.jbpm.process.core.timer.impl.GlobalTimerService) TimerService(org.drools.core.time.TimerService) GlobalTimerService(org.jbpm.process.core.timer.impl.GlobalTimerService)

Aggregations

TimerService (org.drools.core.time.TimerService)1 GlobalSchedulerService (org.jbpm.process.core.timer.GlobalSchedulerService)1 GlobalTimerService (org.jbpm.process.core.timer.impl.GlobalTimerService)1 SchedulerProvider (org.jbpm.runtime.manager.api.SchedulerProvider)1 TransactionAwareSchedulerServiceInterceptor (org.jbpm.runtime.manager.impl.tx.TransactionAwareSchedulerServiceInterceptor)1