public PeriodScheduler(final SchedulerConstructorWrapper schedulerConstructorWrapper) { this.jobConfiguration = schedulerConstructorWrapper.getJobConfiguration(); this.threadPoolTaskScheduler = schedulerConstructorWrapper.getThreadPoolTaskScheduler(); this.jobSchedulerConfiguration = this.jobConfiguration.getJobSchedulerConfiguration(); this.job = schedulerConstructorWrapper.getJob(); this.jobRunner = new JobRunner(this.job, schedulerConstructorWrapper.getJobLauncher(), schedulerConstructorWrapper.getJobParameters(), schedulerConstructorWrapper.getJobIncrementer()); final SchedulerStatus schedulerStatus; if (this.jobSchedulerConfiguration.getSchedulerStatus() != null) { schedulerStatus = this.jobSchedulerConfiguration.getSchedulerStatus(); } else { schedulerStatus = SchedulerStatus.INITIALIZED; } this.setStatus(schedulerStatus); }
public static List<ValueRecord> map(final JobSchedulerConfiguration jobSchedulerConfiguration, final Long jobConfigurationId) { final List<ValueRecord> valueRecords = new ArrayList<>(); final ValueRecord beanName = new ValueRecord(jobConfigurationId, JobSchedulerConfigurationKey.BEAN_NAME, jobSchedulerConfiguration.getBeanName()); final ValueRecord cronExpression = new ValueRecord(jobConfigurationId, JobSchedulerConfigurationKey.CRON_EXPRESSION, jobSchedulerConfiguration.getCronExpression()); final ValueRecord fixedDelay = new ValueRecord(jobConfigurationId, JobSchedulerConfigurationKey.FIXED_DELAY, jobSchedulerConfiguration.getFixedDelay()); final ValueRecord initialDelay = new ValueRecord(jobConfigurationId, JobSchedulerConfigurationKey.INITIAL_DELAY, jobSchedulerConfiguration.getInitialDelay()); final ValueRecord schedulerStatus = new ValueRecord(jobConfigurationId, JobSchedulerConfigurationKey.STATUS, jobSchedulerConfiguration.getSchedulerStatus().getValue()); final ValueRecord schedulerType = new ValueRecord(jobConfigurationId, JobSchedulerConfigurationKey.SCHEDULER_TYPE, jobSchedulerConfiguration.getJobSchedulerType().getId()); final ValueRecord executorType = new ValueRecord(jobConfigurationId, JobSchedulerConfigurationKey.TASK_EXECUTOR_TYPE, jobSchedulerConfiguration.getTaskExecutorType().getId()); valueRecords.add(beanName); valueRecords.add(cronExpression); valueRecords.add(fixedDelay); valueRecords.add(initialDelay); valueRecords.add(schedulerStatus); valueRecords.add(schedulerType); valueRecords.add(executorType); return valueRecords; } }
public PeriodScheduler(final SchedulerConstructorWrapper schedulerConstructorWrapper) { this.jobConfiguration = schedulerConstructorWrapper.getJobConfiguration(); this.threadPoolTaskScheduler = schedulerConstructorWrapper.getThreadPoolTaskScheduler(); this.jobSchedulerConfiguration = this.jobConfiguration.getJobSchedulerConfiguration(); this.job = schedulerConstructorWrapper.getJob(); this.jobRunner = new JobRunner(this.job, schedulerConstructorWrapper.getJobLauncher(), schedulerConstructorWrapper.getJobParameters(), schedulerConstructorWrapper.getJobIncrementer()); final SchedulerStatus schedulerStatus; if (this.jobSchedulerConfiguration.getSchedulerStatus() != null) { schedulerStatus = this.jobSchedulerConfiguration.getSchedulerStatus(); } else { schedulerStatus = SchedulerStatus.INITIALIZED; } this.setStatus(schedulerStatus); }
public CronScheduler(final SchedulerConstructorWrapper schedulerConstructorWrapper) { this.jobConfiguration = schedulerConstructorWrapper.getJobConfiguration(); this.threadPoolTaskScheduler = schedulerConstructorWrapper.getThreadPoolTaskScheduler(); this.jobSchedulerConfiguration = this.jobConfiguration.getJobSchedulerConfiguration(); this.timeZone = TimeZone.getDefault(); this.trigger = new CronTrigger(this.jobSchedulerConfiguration.getCronExpression(), this.timeZone); this.job = schedulerConstructorWrapper.getJob(); this.jobRunner = new JobRunner(this.job, schedulerConstructorWrapper.getJobLauncher(), schedulerConstructorWrapper.getJobParameters(), schedulerConstructorWrapper.getJobIncrementer()); final SchedulerStatus schedulerStatus; if (this.jobSchedulerConfiguration.getSchedulerStatus() != null) { schedulerStatus = this.jobSchedulerConfiguration.getSchedulerStatus(); } else { schedulerStatus = SchedulerStatus.INITIALIZED; } this.setStatus(schedulerStatus); }
public CronScheduler(final SchedulerConstructorWrapper schedulerConstructorWrapper) { this.jobConfiguration = schedulerConstructorWrapper.getJobConfiguration(); this.threadPoolTaskScheduler = schedulerConstructorWrapper.getThreadPoolTaskScheduler(); this.jobSchedulerConfiguration = this.jobConfiguration.getJobSchedulerConfiguration(); this.timeZone = TimeZone.getDefault(); this.trigger = new CronTrigger(this.jobSchedulerConfiguration.getCronExpression(), this.timeZone); this.job = schedulerConstructorWrapper.getJob(); this.jobRunner = new JobRunner(this.job, schedulerConstructorWrapper.getJobLauncher(), schedulerConstructorWrapper.getJobParameters(), schedulerConstructorWrapper.getJobIncrementer()); final SchedulerStatus schedulerStatus; if (this.jobSchedulerConfiguration.getSchedulerStatus() != null) { schedulerStatus = this.jobSchedulerConfiguration.getSchedulerStatus(); } else { schedulerStatus = SchedulerStatus.INITIALIZED; } this.setStatus(schedulerStatus); }
private static JobSchedulerConfiguration map(final org.tuxdevelop.spring.batch.lightmin.domain.JobSchedulerConfiguration jobSchedulerConfiguration) { final JobSchedulerConfiguration response; if (jobSchedulerConfiguration != null) { response = new JobSchedulerConfiguration(); response.setCronExpression(jobSchedulerConfiguration.getCronExpression()); response.setFixedDelay(jobSchedulerConfiguration.getFixedDelay()); response.setInitialDelay(jobSchedulerConfiguration.getInitialDelay()); response.setJobSchedulerType(map(jobSchedulerConfiguration.getJobSchedulerType())); response.setSchedulerStatus(map(jobSchedulerConfiguration.getSchedulerStatus())); response.setTaskExecutorType(map(jobSchedulerConfiguration.getTaskExecutorType())); } else { response = null; } return response; }
private static JobSchedulerConfiguration map(final org.tuxdevelop.spring.batch.lightmin.domain.JobSchedulerConfiguration jobSchedulerConfiguration) { final JobSchedulerConfiguration response; if (jobSchedulerConfiguration != null) { response = new JobSchedulerConfiguration(); response.setCronExpression(jobSchedulerConfiguration.getCronExpression()); response.setFixedDelay(jobSchedulerConfiguration.getFixedDelay()); response.setInitialDelay(jobSchedulerConfiguration.getInitialDelay()); response.setJobSchedulerType(map(jobSchedulerConfiguration.getJobSchedulerType())); response.setSchedulerStatus(map(jobSchedulerConfiguration.getSchedulerStatus())); response.setTaskExecutorType(map(jobSchedulerConfiguration.getTaskExecutorType())); } else { response = null; } return response; }
@Override public void updateJobConfiguration(final JobConfiguration jobConfiguration) { jobConfiguration.validateForUpdate(); try { final JobConfiguration existingJobConfiguration = this.jobConfigurationRepository.getJobConfiguration(jobConfiguration.getJobConfigurationId(), this.springBatchLightminCoreConfigurationProperties.getApplicationName()); if (existingJobConfiguration.getJobSchedulerConfiguration() != null) { final String existingBeanName = existingJobConfiguration.getJobSchedulerConfiguration().getBeanName(); jobConfiguration.getJobSchedulerConfiguration().setBeanName(existingBeanName); this.jobConfigurationRepository.update(jobConfiguration, this.springBatchLightminCoreConfigurationProperties.getApplicationName()); this.schedulerService.refreshSchedulerForJob(jobConfiguration); if (SchedulerStatus.RUNNING.equals(jobConfiguration.getJobSchedulerConfiguration().getSchedulerStatus())) { this.schedulerService.schedule(jobConfiguration.getJobSchedulerConfiguration().getBeanName(), Boolean.TRUE); } else { log.info("Scheduler not started, no scheduling triggered!"); } } else if (existingJobConfiguration.getJobListenerConfiguration() != null) { final String existingBeanName = existingJobConfiguration.getJobListenerConfiguration().getBeanName(); jobConfiguration.getJobListenerConfiguration().setBeanName(existingBeanName); this.jobConfigurationRepository.update(jobConfiguration, this.springBatchLightminCoreConfigurationProperties.getApplicationName()); this.listenerService.refreshListenerForJob(jobConfiguration); } } catch (final NoSuchJobConfigurationException e) { log.error(e.getMessage()); throw new SpringBatchLightminApplicationException(e, e.getMessage()); } }
@Override public void updateJobConfiguration(final JobConfiguration jobConfiguration) { jobConfiguration.validateForUpdate(); try { final JobConfiguration existingJobConfiguration = this.jobConfigurationRepository.getJobConfiguration(jobConfiguration.getJobConfigurationId(), this.springBatchLightminCoreConfigurationProperties.getApplicationName()); if (existingJobConfiguration.getJobSchedulerConfiguration() != null) { final String existingBeanName = existingJobConfiguration.getJobSchedulerConfiguration().getBeanName(); jobConfiguration.getJobSchedulerConfiguration().setBeanName(existingBeanName); this.jobConfigurationRepository.update(jobConfiguration, this.springBatchLightminCoreConfigurationProperties.getApplicationName()); this.schedulerService.refreshSchedulerForJob(jobConfiguration); if (SchedulerStatus.RUNNING.equals(jobConfiguration.getJobSchedulerConfiguration().getSchedulerStatus())) { this.schedulerService.schedule(jobConfiguration.getJobSchedulerConfiguration().getBeanName(), Boolean.TRUE); } else { log.info("Scheduler not started, no scheduling triggered!"); } } else if (existingJobConfiguration.getJobListenerConfiguration() != null) { final String existingBeanName = existingJobConfiguration.getJobListenerConfiguration().getBeanName(); jobConfiguration.getJobListenerConfiguration().setBeanName(existingBeanName); this.jobConfigurationRepository.update(jobConfiguration, this.springBatchLightminCoreConfigurationProperties.getApplicationName()); this.listenerService.refreshListenerForJob(jobConfiguration); } } catch (final NoSuchJobConfigurationException e) { log.error(e.getMessage()); throw new SpringBatchLightminApplicationException(e, e.getMessage()); } }
this.jobConfigurationRepository.update(addedJobConfiguration, this.springBatchLightminCoreConfigurationProperties.getApplicationName()); if (SchedulerStatus.RUNNING.equals(addedJobConfiguration.getJobSchedulerConfiguration().getSchedulerStatus())) { this.schedulerService.schedule(beanName, Boolean.TRUE); } else {
this.jobConfigurationRepository.update(addedJobConfiguration, this.springBatchLightminCoreConfigurationProperties.getApplicationName()); if (SchedulerStatus.RUNNING.equals(addedJobConfiguration.getJobSchedulerConfiguration().getSchedulerStatus())) { this.schedulerService.schedule(beanName, Boolean.TRUE); } else {