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));
}
}
}
}
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;
}
Aggregations