diff --git a/changelog.md b/changelog.md index 7e76b27..261e9c0 100644 --- a/changelog.md +++ b/changelog.md @@ -1,4 +1,7 @@ # Changelog +### 2016-03-02 +* Fix a bug where acquired triggers were not being released. + ### 2016-01-31 * Add support for Redis Sentinel diff --git a/src/main/java/net/joelinn/quartz/jobstore/RedisJobStore.java b/src/main/java/net/joelinn/quartz/jobstore/RedisJobStore.java index 418affe..6e49a72 100644 --- a/src/main/java/net/joelinn/quartz/jobstore/RedisJobStore.java +++ b/src/main/java/net/joelinn/quartz/jobstore/RedisJobStore.java @@ -1005,11 +1005,12 @@ public List doWithLock(JedisCommands jedis) throws JobPersisten * @param trigger the trigger to be released */ @Override - public void releaseAcquiredTrigger(OperableTrigger trigger) { + public void releaseAcquiredTrigger(final OperableTrigger trigger) { try { doWithLock(new LockCallbackWithoutResult() { @Override public Void doWithLock(JedisCommands jedis) throws JobPersistenceException { + storage.releaseAcquiredTrigger(trigger, jedis); return null; } }, "Could not release acquired trigger."); diff --git a/src/test/java/net/joelinn/quartz/RedisJobStoreTest.java b/src/test/java/net/joelinn/quartz/RedisJobStoreTest.java index 24a599b..442603a 100644 --- a/src/test/java/net/joelinn/quartz/RedisJobStoreTest.java +++ b/src/test/java/net/joelinn/quartz/RedisJobStoreTest.java @@ -1,32 +1,15 @@ package net.joelinn.quartz; -import com.google.common.base.Joiner; import net.joelinn.quartz.jobstore.RedisJobStore; -import net.joelinn.quartz.jobstore.RedisJobStoreSchema; import org.junit.Test; import org.quartz.JobDetail; -import org.quartz.Scheduler; -import org.quartz.SchedulerException; import org.quartz.Trigger; -import org.quartz.impl.StdSchedulerFactory; -import org.quartz.impl.triggers.CronTriggerImpl; -import org.quartz.spi.JobStore; -import org.quartz.spi.SchedulerSignaler; -import redis.clients.jedis.*; -import redis.clients.util.Pool; -import redis.embedded.RedisCluster; -import redis.embedded.util.JedisUtil; import java.util.Map; import java.util.Properties; import java.util.Set; -import static org.hamcrest.CoreMatchers.not; -import static org.hamcrest.CoreMatchers.nullValue; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.collection.IsMapContaining.hasKey; import static org.junit.Assert.assertEquals; -import static org.mockito.Mockito.mock; /** * Joe Linn diff --git a/src/test/java/net/joelinn/quartz/RedisSentinelJobStoreTest.java b/src/test/java/net/joelinn/quartz/RedisSentinelJobStoreTest.java index b1c55a4..e25d041 100644 --- a/src/test/java/net/joelinn/quartz/RedisSentinelJobStoreTest.java +++ b/src/test/java/net/joelinn/quartz/RedisSentinelJobStoreTest.java @@ -9,10 +9,8 @@ import org.junit.Test; import org.quartz.SchedulerConfigException; import org.quartz.spi.SchedulerSignaler; -import redis.clients.jedis.Jedis; import redis.clients.jedis.JedisPoolConfig; import redis.clients.jedis.JedisSentinelPool; -import redis.clients.util.Pool; import redis.embedded.RedisCluster; import redis.embedded.util.JedisUtil; @@ -46,7 +44,7 @@ public void setUpRedis() throws IOException, SchedulerConfigException { Set jedisSentinelHosts = JedisUtil.sentinelHosts(redisCluster); - joinedHosts = Joiner.on(",").join(jedisSentinelHosts).toString(); + joinedHosts = Joiner.on(",").join(jedisSentinelHosts); final short database = 1; JedisPoolConfig jedisPoolConfig = new JedisPoolConfig(); diff --git a/src/test/java/net/joelinn/quartz/mixin/CronTriggerMixinTest.java b/src/test/java/net/joelinn/quartz/mixin/CronTriggerMixinTest.java index 5b83bb1..2410497 100644 --- a/src/test/java/net/joelinn/quartz/mixin/CronTriggerMixinTest.java +++ b/src/test/java/net/joelinn/quartz/mixin/CronTriggerMixinTest.java @@ -27,7 +27,7 @@ public class CronTriggerMixinTest { @Before public void setUp(){ mapper = new ObjectMapper(); - mapper.addMixInAnnotations(CronTrigger.class, CronTriggerMixin.class); + mapper.addMixIn(CronTrigger.class, CronTriggerMixin.class); } @Test diff --git a/src/test/java/net/joelinn/quartz/mixin/JobDetailMixinTest.java b/src/test/java/net/joelinn/quartz/mixin/JobDetailMixinTest.java index 5915e93..5018cdd 100644 --- a/src/test/java/net/joelinn/quartz/mixin/JobDetailMixinTest.java +++ b/src/test/java/net/joelinn/quartz/mixin/JobDetailMixinTest.java @@ -27,7 +27,7 @@ public class JobDetailMixinTest { @Before public void setUp(){ mapper = new ObjectMapper(); - mapper.addMixInAnnotations(JobDetail.class, JobDetailMixin.class); + mapper.addMixIn(JobDetail.class, JobDetailMixin.class); } @Test diff --git a/src/test/java/net/joelinn/quartz/mixin/SimpleTriggerMixinTest.java b/src/test/java/net/joelinn/quartz/mixin/SimpleTriggerMixinTest.java index 2b7c3cb..2e717cf 100644 --- a/src/test/java/net/joelinn/quartz/mixin/SimpleTriggerMixinTest.java +++ b/src/test/java/net/joelinn/quartz/mixin/SimpleTriggerMixinTest.java @@ -27,7 +27,7 @@ public class SimpleTriggerMixinTest { @Before public void setUp(){ mapper = new ObjectMapper(); - mapper.addMixInAnnotations(SimpleTrigger.class, TriggerMixin.class); + mapper.addMixIn(SimpleTrigger.class, TriggerMixin.class); } @Test