Skip to content

Commit

Permalink
Merge branch 'master' of github.com:jlinn/quartz-redis-jobstore
Browse files Browse the repository at this point in the history
  • Loading branch information
jlinn committed Jul 2, 2017
2 parents 5e8bf09 + d8c6fa9 commit a996af6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,21 @@ public void storeJob(JobDetail jobDetail, boolean replaceExisting, JedisCluster
@Override
public boolean removeJob(JobKey jobKey, JedisCluster jedis) throws JobPersistenceException {
final String jobHashKey = redisSchema.jobHashKey(jobKey);
final String jobBlockedKey = redisSchema.jobBlockedKey(jobKey);
final String jobDataMapHashKey = redisSchema.jobDataMapHashKey(jobKey);
final String jobGroupSetKey = redisSchema.jobGroupSetKey(jobKey);
final String jobTriggerSetKey = redisSchema.jobTriggersSetKey(jobKey);

// remove the job and any associated data
Long delJobHashKeyResponse = jedis.del(jobHashKey);
// remove the blocked job key
jedis.del(jobBlockedKey);
// remove the job's data map
jedis.del(jobDataMapHashKey);
// remove the job from the set of all jobs
jedis.srem(redisSchema.jobsSet(), jobHashKey);
// remove the job from the set of blocked jobs
jedis.srem(redisSchema.blockedJobsSet(), jobHashKey);
// remove the job from its group
jedis.srem(jobGroupSetKey, jobHashKey);
// retrieve the keys for all triggers associated with this job, then delete that set
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/net/joelinn/quartz/jobstore/RedisStorage.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,22 @@ public RedisStorage(RedisJobStoreSchema redisSchema, ObjectMapper mapper, Schedu
@Override
public boolean removeJob(JobKey jobKey, Jedis jedis) throws JobPersistenceException {
final String jobHashKey = redisSchema.jobHashKey(jobKey);
final String jobBlockedKey = redisSchema.jobBlockedKey(jobKey);
final String jobDataMapHashKey = redisSchema.jobDataMapHashKey(jobKey);
final String jobGroupSetKey = redisSchema.jobGroupSetKey(jobKey);
final String jobTriggerSetKey = redisSchema.jobTriggersSetKey(jobKey);

Pipeline pipe = jedis.pipelined();
// remove the job and any associated data
Response<Long> delJobHashKeyResponse = pipe.del(jobHashKey);
// remove the blocked job key
pipe.del(jobBlockedKey);
// remove the job's data map
pipe.del(jobDataMapHashKey);
// remove the job from the set of all jobs
pipe.srem(redisSchema.jobsSet(), jobHashKey);
// remove the job from the set of blocked jobs
pipe.srem(redisSchema.blockedJobsSet(), jobHashKey);
// remove the job from its group
pipe.srem(jobGroupSetKey, jobHashKey);
// retrieve the keys for all triggers associated with this job, then delete that set
Expand Down

0 comments on commit a996af6

Please sign in to comment.