Search in sources :

Example 1 with GlobalSchedulerService

use of org.jbpm.process.core.timer.GlobalSchedulerService 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)

Example 2 with GlobalSchedulerService

use of org.jbpm.process.core.timer.GlobalSchedulerService in project jbpm by kiegroup.

the class AbstractRuntimeManager method close.

public void close(boolean removeJobs) {
    cacheManager.dispose();
    environment.close();
    registry.remove(identifier);
    TimerService timerService = TimerServiceRegistry.getInstance().get(getIdentifier() + TimerServiceRegistry.TIMER_SERVICE_SUFFIX);
    if (timerService != null) {
        try {
            if (removeJobs && timerService instanceof GlobalTimerService) {
                ((GlobalTimerService) timerService).destroy();
            }
            timerService.shutdown();
            GlobalSchedulerService schedulerService = ((SchedulerProvider) environment).getSchedulerService();
            if (schedulerService != null) {
                schedulerService.shutdown();
            }
        } finally {
            TimerServiceRegistry.getInstance().remove(getIdentifier() + TimerServiceRegistry.TIMER_SERVICE_SUFFIX);
        }
    }
    this.closed = true;
}
Also used : GlobalSchedulerService(org.jbpm.process.core.timer.GlobalSchedulerService) SchedulerProvider(org.jbpm.runtime.manager.api.SchedulerProvider) 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)2 GlobalSchedulerService (org.jbpm.process.core.timer.GlobalSchedulerService)2 GlobalTimerService (org.jbpm.process.core.timer.impl.GlobalTimerService)2 SchedulerProvider (org.jbpm.runtime.manager.api.SchedulerProvider)2 TransactionAwareSchedulerServiceInterceptor (org.jbpm.runtime.manager.impl.tx.TransactionAwareSchedulerServiceInterceptor)1