formatting work

This commit is contained in:
eugenp
2016-10-12 08:02:05 +03:00
parent eb7650eead
commit 856be0a08a
128 changed files with 2039 additions and 2275 deletions

View File

@@ -10,7 +10,6 @@ import org.springframework.scheduling.annotation.EnableScheduling;
public class SpringQuartzApp {
public static void main(String[] args) {
new SpringApplicationBuilder(SpringQuartzApp.class)
.showBanner(false).run(args);
new SpringApplicationBuilder(SpringQuartzApp.class).showBanner(false).run(args);
}
}

View File

@@ -45,8 +45,7 @@ public class QrtzScheduler {
}
@Bean
public Scheduler scheduler(Trigger trigger, JobDetail job)
throws SchedulerException, IOException {
public Scheduler scheduler(Trigger trigger, JobDetail job) throws SchedulerException, IOException {
StdSchedulerFactory factory = new StdSchedulerFactory();
factory.initialize(new ClassPathResource("quartz.properties").getInputStream());
@@ -64,9 +63,7 @@ public class QrtzScheduler {
@Bean
public JobDetail jobDetail() {
return newJob().ofType(SampleJob.class).storeDurably()
.withIdentity(JobKey.jobKey("Qrtz_Job_Detail"))
.withDescription("Invoke Sample Job service...").build();
return newJob().ofType(SampleJob.class).storeDurably().withIdentity(JobKey.jobKey("Qrtz_Job_Detail")).withDescription("Invoke Sample Job service...").build();
}
@Bean
@@ -75,10 +72,6 @@ public class QrtzScheduler {
int frequencyInSec = 10;
logger.info("Configuring trigger to fire every {} seconds", frequencyInSec);
return newTrigger().forJob(job).withIdentity(TriggerKey.triggerKey("Qrtz_Trigger"))
.withDescription("Sample trigger")
.withSchedule(
simpleSchedule().withIntervalInSeconds(frequencyInSec).repeatForever())
.build();
return newTrigger().forJob(job).withIdentity(TriggerKey.triggerKey("Qrtz_Trigger")).withDescription("Sample trigger").withSchedule(simpleSchedule().withIntervalInSeconds(frequencyInSec).repeatForever()).build();
}
}

View File

@@ -19,8 +19,7 @@ public class SampleJob implements Job {
public void execute(JobExecutionContext context) throws JobExecutionException {
logger.info("Job ** {} ** fired @ {}", context.getJobDetail().getKey().getName(),
context.getFireTime());
logger.info("Job ** {} ** fired @ {}", context.getJobDetail().getKey().getName(), context.getFireTime());
jobService.executeSampleJob();

View File

@@ -11,21 +11,17 @@ import org.springframework.scheduling.quartz.SpringBeanJobFactory;
* Adds auto-wiring support to quartz jobs.
* @see "https://gist.github.com/jelies/5085593"
*/
public final class AutoWiringSpringBeanJobFactory extends SpringBeanJobFactory
implements ApplicationContextAware {
public final class AutoWiringSpringBeanJobFactory extends SpringBeanJobFactory implements ApplicationContextAware {
private transient AutowireCapableBeanFactory beanFactory;
public void setApplicationContext(ApplicationContext applicationContext)
throws BeansException {
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
beanFactory = applicationContext.getAutowireCapableBeanFactory();
}
@Override
protected Object createJobInstance(final TriggerFiredBundle bundle)
throws Exception {
protected Object createJobInstance(final TriggerFiredBundle bundle) throws Exception {
final Object job = super.createJobInstance(bundle);
beanFactory.autowireBean(job);