Skip to content

Commit

Permalink
Updated Quartz to 2.1.5 [IMMUTANT-136] [TORQUE-953]
Browse files Browse the repository at this point in the history
  • Loading branch information
jcrossley3 committed Oct 6, 2012
1 parent 56e3504 commit f5a8296
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 12 deletions.
12 changes: 7 additions & 5 deletions jobs/src/main/java/org/projectodd/polyglot/jobs/BaseJob.java
Expand Up @@ -23,10 +23,12 @@
import java.util.List;

import org.quartz.JobExecutionContext;
import org.quartz.JobKey;


public class BaseJob {
public BaseJob(String jobName) {
this.jobName = jobName;
public BaseJob(JobKey jobKey) {
this.jobKey = jobKey;
}

public void addListener(JobListener listener) {
Expand Down Expand Up @@ -57,10 +59,10 @@ public void notifyInterrupted() {
}
}

public String getJobName() {
return jobName;
public JobKey getJobKey() {
return jobKey;
}

protected String jobName;
protected JobKey jobKey;
private List<JobListener> listeners = new ArrayList<JobListener>();
}
Expand Up @@ -31,8 +31,11 @@
import org.jboss.msc.value.InjectedValue;
import org.projectodd.polyglot.core.util.TimeInterval;
import org.quartz.CronTrigger;
import org.quartz.impl.triggers.CronTriggerImpl;
import static org.quartz.TriggerKey.*;
import org.quartz.Job;
import org.quartz.JobDetail;
import org.quartz.JobKey;
import org.quartz.impl.JobDetailImpl;
import org.quartz.Scheduler;
import org.quartz.SchedulerException;

Expand Down Expand Up @@ -79,15 +82,15 @@ public void stop(StopContext context) {
}

public synchronized void start() throws ParseException, SchedulerException {
this.jobDetail = new JobDetail();
this.jobDetail = new JobDetailImpl();
this.jobDetail.setGroup( this.group );
this.jobDetail.setName( this.name );
this.jobDetail.setDescription( this.description );
this.jobDetail.setJobClass( this.jobClass );
this.jobDetail.setRequestsRecovery( true );
this.jobDetail.getJobDataMap().put("timeout", timeout);

CronTrigger trigger = new CronTrigger( getTriggerName(), this.group, this.cronExpression );
CronTrigger trigger = new CronTriggerImpl( getTriggerName(), this.group, this.cronExpression );

Scheduler scheduler = getScheduler();

Expand All @@ -97,7 +100,7 @@ public synchronized void start() throws ParseException, SchedulerException {

public synchronized void stop() {
try {
getScheduler().unscheduleJob( getTriggerName(), this.group );
getScheduler().unscheduleJob( triggerKey(getTriggerName(), this.group) );
} catch (SchedulerException ex) {
log.warn( "An error occurred stoping job " + this.name, ex );
}
Expand Down Expand Up @@ -141,6 +144,10 @@ public String getName() {
return this.name;
}

public JobKey getKey() {
return this.jobDetail.getKey();
}

public String getDescription() {
return this.description;
}
Expand Down Expand Up @@ -179,7 +186,7 @@ public void setTimeout(long timeout) {
private String cronExpression;
private TimeInterval timeout;

private JobDetail jobDetail;
private JobDetailImpl jobDetail;
private boolean singleton;

private static final Logger log = Logger.getLogger( "org.projectodd.polyglot.jobs" );
Expand Down
Expand Up @@ -48,7 +48,7 @@ public void run() {
try {
((InterruptableJob) context.getJobInstance()).interrupt();
} catch (Exception e) {
log.error("Failed to interrupt job " + job.getJobName(), e);
log.error("Failed to interrupt job " + job.getJobKey(), e);
}


Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Expand Up @@ -71,7 +71,7 @@
<properties>
<version.junit>4.7</version.junit>
<version.mockito>1.8.4</version.mockito>
<version.org.quartz-scheduler>1.8.5</version.org.quartz-scheduler>
<version.org.quartz-scheduler>2.1.5</version.org.quartz-scheduler>
<version.org.slf4j>1.5.10</version.org.slf4j>
</properties>

Expand Down

0 comments on commit f5a8296

Please sign in to comment.