public RegisteredTimerServiceDelegate(String timerServiceKey) { timerService = TimerServiceRegistry.getInstance().get(timerServiceKey); if (timerService == null) { throw new IllegalStateException("TimerService with key " + timerServiceKey + " was not found in the registry"); } }
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)); } } } }
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; }
protected void findDelegate() { if (delegate == null) { Collection<TimerJobInstance> timers = TimerServiceRegistry.getInstance().get(timerServiceId) .getTimerJobFactoryManager().getTimerJobInstances(); for (TimerJobInstance instance : timers) { if (((GlobalQuartzJobHandle)instance.getJobHandle()).getJobName().equals(jobname)) { delegate = instance; break; } } } }
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; }
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)); } } } }
TimerService timerService = TimerServiceRegistry.getInstance().get(getIdentifier() + TimerServiceRegistry.TIMER_SERVICE_SUFFIX); if (timerService != null) { if (timerService instanceof GlobalTimerService) {
/** * This code takes care of configuring the runtime environment to configure the timer service * (an internal component of the KIE Session used to measure how time progresses, used * for signals and time based rules). It will create a specific timer service, separate from any * other, exclusively for the new runitme manager, and if the configuration makes it a transactional * object, it adds an interceptor to the timer service to store scheduled tasks in the database as well. */ 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, schedulerService)); } } } } }
String deploymentId = task.getTaskData().getDeploymentId(); TimerService timerService = TimerServiceRegistry.getInstance().get(deploymentId + TimerServiceRegistry.TIMER_SERVICE_SUFFIX); if (timerService != null && timerService instanceof GlobalTimerService) { TaskDeadlineJob deadlineJob = new TaskDeadlineJob(taskId, deadlineId, type, deploymentId, task.getTaskData().getProcessInstanceId());
TimerService timerService = TimerServiceRegistry.getInstance().get(getIdentifier() + TimerServiceRegistry.TIMER_SERVICE_SUFFIX); if (timerService != null) { if (timerService instanceof GlobalTimerService) {
TimerService timerService = TimerServiceRegistry.getInstance().get(getIdentifier() + TimerServiceRegistry.TIMER_SERVICE_SUFFIX); if (timerService != null) { if (timerService instanceof GlobalTimerService) {
public void unschedule(long taskId, Deadline deadline, DeadlineType type) { Task task = persistenceContext.findTask(taskId); String deploymentId = task.getTaskData().getDeploymentId(); Deadlines deadlines = ((InternalTask)task).getDeadlines(); TimerService timerService = TimerServiceRegistry.getInstance().get(deploymentId + TimerServiceRegistry.TIMER_SERVICE_SUFFIX); if (timerService != null && timerService instanceof GlobalTimerService) { TaskDeadlineJob deadlineJob = new TaskDeadlineJob(taskId, deadline.getId(), type, deploymentId, task.getTaskData().getProcessInstanceId()); logger.debug("unscheduling timer job for deadline {} {} and task {} using timer service {}", deadlineJob.getId(), deadline.getId(), taskId, timerService); JobHandle jobHandle = jobHandles.remove(deadlineJob.getId()); if (jobHandle == null) { jobHandle = ((GlobalTimerService) timerService).buildJobHandleForContext(new TaskDeadlineJobContext(deadlineJob.getId(), task.getTaskData().getProcessInstanceId(), deploymentId)); } timerService.removeJob(jobHandle); // mark the deadlines so they won't be rescheduled again deadline.setEscalated(true); } }
JDKCallableJobCommand command = new JDKCallableJobCommand( this ); if (scheduler == null) { scheduler = (InternalSchedulerService) TimerServiceRegistry.getInstance().get(timerServiceId);
TimerService timerService = TimerServiceRegistry.getInstance().get(deploymentId + TimerServiceRegistry.TIMER_SERVICE_SUFFIX); if (timerService != null && timerService instanceof GlobalTimerService) {
public RegisteredTimerServiceDelegate(String timerServiceKey) { timerService = TimerServiceRegistry.getInstance().get(timerServiceKey); if (timerService == null) { throw new IllegalStateException("TimerService with key " + timerServiceKey + " was not found in the registry"); } }
protected void findDelegate() { if (delegate == null) { Collection<TimerJobInstance> timers = TimerServiceRegistry.getInstance().get(timerServiceId) .getTimerJobFactoryManager().getTimerJobInstances(); for (TimerJobInstance instance : timers) { if (((GlobalQuartzJobHandle)instance.getJobHandle()).getJobName().equals(jobname)) { delegate = instance; break; } } } }
while (TimerServiceRegistry.getInstance().get(timerServiceId) == null) { logger.debug("waiting for timer service to be available, elapsed time {} ms", time); try {
TimerService timerService = TimerServiceRegistry.getInstance().get(getIdentifier() + TimerServiceRegistry.TIMER_SERVICE_SUFFIX); if (timerService != null) { if (timerService instanceof GlobalTimerService) {
TimerService timerService = TimerServiceRegistry.getInstance().get(getIdentifier() + TimerServiceRegistry.TIMER_SERVICE_SUFFIX); if (timerService != null) { if (timerService instanceof GlobalTimerService) {
TimerService timerService = TimerServiceRegistry.getInstance().get(getIdentifier() + TimerServiceRegistry.TIMER_SERVICE_SUFFIX); if (timerService != null) { if (timerService instanceof GlobalTimerService) {