diff --git a/build.gradle.kts b/build.gradle.kts index bdbe088..b87c10d 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -10,20 +10,18 @@ repositories { dependencies { implementation("org.quartz-scheduler:quartz:2.3.2") implementation("org.quartz-scheduler:quartz-jobs:2.3.2") - implementation("redis.clients:jedis:3.5.2") - implementation("com.fasterxml.jackson.core:jackson-core:2.11.1") - implementation("com.fasterxml.jackson.core:jackson-annotations:2.11.1") - implementation("com.fasterxml.jackson.core:jackson-databind:2.11.1") - implementation("org.slf4j:slf4j-api:1.7.7") - testImplementation("junit:junit:4.12") + implementation("redis.clients:jedis:4.2.3") + implementation("com.fasterxml.jackson.core:jackson-core:2.13.1") + implementation("com.fasterxml.jackson.core:jackson-annotations:2.13.1") + implementation("com.fasterxml.jackson.core:jackson-databind:2.13.1") + implementation("org.slf4j:slf4j-api:1.7.36") + testImplementation("junit:junit:4.13.2") testImplementation("org.hamcrest:hamcrest-all:1.3") - testImplementation("org.mockito:mockito-all:1.9.5") + testImplementation("org.mockito:mockito-all:1.10.19") testImplementation("com.google.guava:guava-io:r03") - testImplementation("commons-io:commons-io:2.4") + testImplementation("commons-io:commons-io:2.11.0") testImplementation("com.github.kstyrc:embedded-redis:0.6") - testImplementation("net.jodah:concurrentunit:0.4.2") - testImplementation("ch.qos.logback:logback-classic:1.1.7") - testImplementation("ch.qos.logback:logback-core:1.1.7") + testImplementation("net.jodah:concurrentunit:0.4.6") } val gitVersion: groovy.lang.Closure by extra diff --git a/src/main/java/net/joelinn/quartz/jobstore/AbstractRedisStorage.java b/src/main/java/net/joelinn/quartz/jobstore/AbstractRedisStorage.java index 29e4830..1565c02 100644 --- a/src/main/java/net/joelinn/quartz/jobstore/AbstractRedisStorage.java +++ b/src/main/java/net/joelinn/quartz/jobstore/AbstractRedisStorage.java @@ -11,9 +11,9 @@ import org.quartz.utils.ClassUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import redis.clients.jedis.Tuple; import redis.clients.jedis.commands.JedisCommands; import redis.clients.jedis.params.SetParams; +import redis.clients.jedis.resps.Tuple; import java.io.IOException; import java.util.*; @@ -420,7 +420,7 @@ public Calendar retrieveCalendar(String name, T jedis) throws JobPersistenceExce * @return the number of jobs currently persisted in the jobstore */ public int getNumberOfJobs(T jedis){ - return jedis.scard(redisSchema.jobsSet()).intValue(); + return (int) jedis.scard(redisSchema.jobsSet()); } /** @@ -429,7 +429,7 @@ public int getNumberOfJobs(T jedis){ * @return the number of triggers currently persisted in the jobstore */ public int getNumberOfTriggers(T jedis){ - return jedis.scard(redisSchema.triggersSet()).intValue(); + return (int) jedis.scard(redisSchema.triggersSet()); } /** @@ -438,7 +438,7 @@ public int getNumberOfTriggers(T jedis){ * @return the number of calendars currently persisted in the jobstore */ public int getNumberOfCalendars(T jedis){ - return jedis.scard(redisSchema.calendarsSet()).intValue(); + return (int) jedis.scard(redisSchema.calendarsSet()); } /** diff --git a/src/main/java/net/joelinn/quartz/jobstore/RedisClusterStorage.java b/src/main/java/net/joelinn/quartz/jobstore/RedisClusterStorage.java index 14461e3..2d030fe 100644 --- a/src/main/java/net/joelinn/quartz/jobstore/RedisClusterStorage.java +++ b/src/main/java/net/joelinn/quartz/jobstore/RedisClusterStorage.java @@ -3,7 +3,6 @@ import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; -import net.joelinn.quartz.jobstore.jedis.JedisClusterCommandsWrapper; import org.quartz.Calendar; import org.quartz.*; import org.quartz.impl.matchers.GroupMatcher; @@ -22,7 +21,7 @@ * Joe Linn * 8/22/2015 */ -public class RedisClusterStorage extends AbstractRedisStorage { +public class RedisClusterStorage extends AbstractRedisStorage { private static final Logger logger = LoggerFactory.getLogger(RedisClusterStorage.class); public RedisClusterStorage(RedisJobStoreSchema redisSchema, ObjectMapper mapper, SchedulerSignaler signaler, String schedulerInstanceId, int lockTimeout) { @@ -39,7 +38,7 @@ public RedisClusterStorage(RedisJobStoreSchema redisSchema, ObjectMapper mapper, */ @Override @SuppressWarnings("unchecked") - public void storeJob(JobDetail jobDetail, boolean replaceExisting, JedisClusterCommandsWrapper jedis) throws ObjectAlreadyExistsException { + public void storeJob(JobDetail jobDetail, boolean replaceExisting, JedisCluster jedis) throws ObjectAlreadyExistsException { final String jobHashKey = redisSchema.jobHashKey(jobDetail.getKey()); final String jobDataMapHashKey = redisSchema.jobDataMapHashKey(jobDetail.getKey()); final String jobGroupSetKey = redisSchema.jobGroupSetKey(jobDetail.getKey()); @@ -68,7 +67,7 @@ public void storeJob(JobDetail jobDetail, boolean replaceExisting, JedisClusterC * @return true if the job was removed; false if it did not exist */ @Override - public boolean removeJob(JobKey jobKey, JedisClusterCommandsWrapper jedis) throws JobPersistenceException { + 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); @@ -124,7 +123,7 @@ public boolean removeJob(JobKey jobKey, JedisClusterCommandsWrapper jedis) throw * @throws ObjectAlreadyExistsException */ @Override - public void storeTrigger(OperableTrigger trigger, boolean replaceExisting, JedisClusterCommandsWrapper jedis) throws JobPersistenceException { + public void storeTrigger(OperableTrigger trigger, boolean replaceExisting, JedisCluster jedis) throws JobPersistenceException { final String triggerHashKey = redisSchema.triggerHashKey(trigger.getKey()); final String triggerGroupSetKey = redisSchema.triggerGroupSetKey(trigger.getKey()); final String jobTriggerSetKey = redisSchema.jobTriggersSetKey(trigger.getJobKey()); @@ -186,7 +185,7 @@ public void storeTrigger(OperableTrigger trigger, boolean replaceExisting, Jedis * @return true if the trigger was found and removed */ @Override - protected boolean removeTrigger(TriggerKey triggerKey, boolean removeNonDurableJob, JedisClusterCommandsWrapper jedis) throws JobPersistenceException, ClassNotFoundException { + protected boolean removeTrigger(TriggerKey triggerKey, boolean removeNonDurableJob, JedisCluster jedis) throws JobPersistenceException, ClassNotFoundException { final String triggerHashKey = redisSchema.triggerHashKey(triggerKey); final String triggerGroupSetKey = redisSchema.triggerGroupSetKey(triggerKey); @@ -241,7 +240,7 @@ protected boolean removeTrigger(TriggerKey triggerKey, boolean removeNonDurableJ * @throws JobPersistenceException if the unset operation failed */ @Override - public boolean unsetTriggerState(String triggerHashKey, JedisClusterCommandsWrapper jedis) throws JobPersistenceException { + public boolean unsetTriggerState(String triggerHashKey, JedisCluster jedis) throws JobPersistenceException { boolean removed = false; List responses = new ArrayList<>(RedisTriggerState.values().length); for (RedisTriggerState state : RedisTriggerState.values()) { @@ -268,7 +267,7 @@ public boolean unsetTriggerState(String triggerHashKey, JedisClusterCommandsWrap * @throws JobPersistenceException */ @Override - public void storeCalendar(String name, Calendar calendar, boolean replaceExisting, boolean updateTriggers, JedisClusterCommandsWrapper jedis) throws JobPersistenceException { + public void storeCalendar(String name, Calendar calendar, boolean replaceExisting, boolean updateTriggers, JedisCluster jedis) throws JobPersistenceException { final String calendarHashKey = redisSchema.calendarHashKey(name); if (!replaceExisting && jedis.exists(calendarHashKey)) { throw new ObjectAlreadyExistsException(String.format("Calendar with key %s already exists.", calendarHashKey)); @@ -306,7 +305,7 @@ public void storeCalendar(String name, Calendar calendar, boolean replaceExistin * @return true if a calendar with the given name was found and removed */ @Override - public boolean removeCalendar(String calendarName, JedisClusterCommandsWrapper jedis) throws JobPersistenceException { + public boolean removeCalendar(String calendarName, JedisCluster jedis) throws JobPersistenceException { final String calendarTriggersSetKey = redisSchema.calendarTriggersSetKey(calendarName); if (jedis.scard(calendarTriggersSetKey) > 0) { @@ -327,7 +326,7 @@ public boolean removeCalendar(String calendarName, JedisClusterCommandsWrapper j * @return the set of all JobKeys which have the given group name */ @Override - public Set getJobKeys(GroupMatcher matcher, JedisClusterCommandsWrapper jedis) { + public Set getJobKeys(GroupMatcher matcher, JedisCluster jedis) { Set jobKeys = new HashSet<>(); if (matcher.getCompareWithOperator() == StringMatcher.StringOperatorName.EQUALS) { final String jobGroupSetKey = redisSchema.jobGroupSetKey(new JobKey("", matcher.getCompareToValue())); @@ -363,7 +362,7 @@ public Set getJobKeys(GroupMatcher matcher, JedisClusterCommands * @return the set of all TriggerKeys which have the given group name */ @Override - public Set getTriggerKeys(GroupMatcher matcher, JedisClusterCommandsWrapper jedis) { + public Set getTriggerKeys(GroupMatcher matcher, JedisCluster jedis) { Set triggerKeys = new HashSet<>(); if (matcher.getCompareWithOperator() == StringMatcher.StringOperatorName.EQUALS) { final String triggerGroupSetKey = redisSchema.triggerGroupSetKey(new TriggerKey("", matcher.getCompareToValue())); @@ -399,7 +398,7 @@ public Set getTriggerKeys(GroupMatcher matcher, JedisClu * @return the state of the trigger */ @Override - public Trigger.TriggerState getTriggerState(TriggerKey triggerKey, JedisClusterCommandsWrapper jedis) { + public Trigger.TriggerState getTriggerState(TriggerKey triggerKey, JedisCluster jedis) { final String triggerHashKey = redisSchema.triggerHashKey(triggerKey); Map scores = new HashMap<>(RedisTriggerState.values().length); for (RedisTriggerState redisTriggerState : RedisTriggerState.values()) { @@ -414,7 +413,7 @@ public Trigger.TriggerState getTriggerState(TriggerKey triggerKey, JedisClusterC } @Override - public void resetTriggerFromErrorState(TriggerKey triggerKey, JedisClusterCommandsWrapper jedis) throws JobPersistenceException { + public void resetTriggerFromErrorState(TriggerKey triggerKey, JedisCluster jedis) throws JobPersistenceException { final String triggerHashKey = redisSchema.triggerHashKey(triggerKey); Boolean exists = jedis.exists(triggerHashKey); Double erroredScore = jedis.zscore(redisSchema.triggerStateKey(RedisTriggerState.ERROR), triggerHashKey); @@ -447,7 +446,7 @@ public void resetTriggerFromErrorState(TriggerKey triggerKey, JedisClusterComman * @throws JobPersistenceException if the desired trigger does not exist */ @Override - public void pauseTrigger(TriggerKey triggerKey, JedisClusterCommandsWrapper jedis) throws JobPersistenceException { + public void pauseTrigger(TriggerKey triggerKey, JedisCluster jedis) throws JobPersistenceException { final String triggerHashKey = redisSchema.triggerHashKey(triggerKey); Boolean exists = jedis.exists(triggerHashKey); Double completedScore = jedis.zscore(redisSchema.triggerStateKey(RedisTriggerState.COMPLETED), triggerHashKey); @@ -480,7 +479,7 @@ public void pauseTrigger(TriggerKey triggerKey, JedisClusterCommandsWrapper jedi * @throws JobPersistenceException */ @Override - public Collection pauseTriggers(GroupMatcher matcher, JedisClusterCommandsWrapper jedis) throws JobPersistenceException { + public Collection pauseTriggers(GroupMatcher matcher, JedisCluster jedis) throws JobPersistenceException { Set pausedTriggerGroups = new HashSet<>(); if (matcher.getCompareWithOperator() == StringMatcher.StringOperatorName.EQUALS) { final String triggerGroupSetKey = redisSchema.triggerGroupSetKey(new TriggerKey("", matcher.getCompareToValue())); @@ -521,7 +520,7 @@ public Collection pauseTriggers(GroupMatcher matcher, JedisC * @throws JobPersistenceException */ @Override - public Collection pauseJobs(GroupMatcher groupMatcher, JedisClusterCommandsWrapper jedis) throws JobPersistenceException { + public Collection pauseJobs(GroupMatcher groupMatcher, JedisCluster jedis) throws JobPersistenceException { Set pausedJobGroups = new HashSet<>(); if (groupMatcher.getCompareWithOperator() == StringMatcher.StringOperatorName.EQUALS) { final String jobGroupSetKey = redisSchema.jobGroupSetKey(new JobKey("", groupMatcher.getCompareToValue())); @@ -558,7 +557,7 @@ public Collection pauseJobs(GroupMatcher groupMatcher, JedisClus * @param jedis a thread-safe Redis connection */ @Override - public void resumeTrigger(TriggerKey triggerKey, JedisClusterCommandsWrapper jedis) throws JobPersistenceException { + public void resumeTrigger(TriggerKey triggerKey, JedisCluster jedis) throws JobPersistenceException { final String triggerHashKey = redisSchema.triggerHashKey(triggerKey); Boolean exists = jedis.sismember(redisSchema.triggersSet(), triggerHashKey); Double isPaused = jedis.zscore(redisSchema.triggerStateKey(RedisTriggerState.PAUSED), triggerHashKey); @@ -594,7 +593,7 @@ public void resumeTrigger(TriggerKey triggerKey, JedisClusterCommandsWrapper jed * @return the names of trigger groups which were resumed */ @Override - public Collection resumeTriggers(GroupMatcher matcher, JedisClusterCommandsWrapper jedis) throws JobPersistenceException { + public Collection resumeTriggers(GroupMatcher matcher, JedisCluster jedis) throws JobPersistenceException { Set resumedTriggerGroups = new HashSet<>(); if (matcher.getCompareWithOperator() == StringMatcher.StringOperatorName.EQUALS) { final String triggerGroupSetKey = redisSchema.triggerGroupSetKey(new TriggerKey("", matcher.getCompareToValue())); @@ -623,7 +622,7 @@ public Collection resumeTriggers(GroupMatcher matcher, Jedis * @return the set of job groups which were matched and resumed */ @Override - public Collection resumeJobs(GroupMatcher matcher, JedisClusterCommandsWrapper jedis) throws JobPersistenceException { + public Collection resumeJobs(GroupMatcher matcher, JedisCluster jedis) throws JobPersistenceException { Set resumedJobGroups = new HashSet<>(); if (matcher.getCompareWithOperator() == StringMatcher.StringOperatorName.EQUALS) { final String jobGroupSetKey = redisSchema.jobGroupSetKey(new JobKey("", matcher.getCompareToValue())); @@ -658,7 +657,7 @@ public Collection resumeJobs(GroupMatcher matcher, JedisClusterC * could be fired. */ @Override - public List triggersFired(List triggers, JedisClusterCommandsWrapper jedis) throws JobPersistenceException, ClassNotFoundException { + public List triggersFired(List triggers, JedisCluster jedis) throws JobPersistenceException, ClassNotFoundException { List results = new ArrayList<>(); for (OperableTrigger trigger : triggers) { final String triggerHashKey = redisSchema.triggerHashKey(trigger.getKey()); @@ -743,7 +742,7 @@ public List triggersFired(List triggers, Je * @param jedis a thread-safe Redis connection */ @Override - public void triggeredJobComplete(OperableTrigger trigger, JobDetail jobDetail, Trigger.CompletedExecutionInstruction triggerInstCode, JedisClusterCommandsWrapper jedis) throws JobPersistenceException, ClassNotFoundException { + public void triggeredJobComplete(OperableTrigger trigger, JobDetail jobDetail, Trigger.CompletedExecutionInstruction triggerInstCode, JedisCluster jedis) throws JobPersistenceException, ClassNotFoundException { final String jobHashKey = redisSchema.jobHashKey(jobDetail.getKey()); final String jobDataMapHashKey = redisSchema.jobDataMapHashKey(jobDetail.getKey()); final String triggerHashKey = redisSchema.triggerHashKey(trigger.getKey()); diff --git a/src/main/java/net/joelinn/quartz/jobstore/RedisJobStore.java b/src/main/java/net/joelinn/quartz/jobstore/RedisJobStore.java index 1dc7c0a..17e062d 100644 --- a/src/main/java/net/joelinn/quartz/jobstore/RedisJobStore.java +++ b/src/main/java/net/joelinn/quartz/jobstore/RedisJobStore.java @@ -2,11 +2,11 @@ import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.databind.ObjectMapper; -import net.joelinn.quartz.jobstore.jedis.JedisClusterCommandsWrapper; import net.joelinn.quartz.jobstore.mixin.CronTriggerMixin; import net.joelinn.quartz.jobstore.mixin.HolidayCalendarMixin; import net.joelinn.quartz.jobstore.mixin.JobDetailMixin; import net.joelinn.quartz.jobstore.mixin.TriggerMixin; +import org.apache.commons.pool2.impl.GenericObjectPoolConfig; import org.quartz.Calendar; import org.quartz.*; import org.quartz.impl.calendar.HolidayCalendar; @@ -30,7 +30,7 @@ public class RedisJobStore implements JobStore { private Pool jedisPool; - private JedisClusterCommandsWrapper jedisCluster; + private JedisCluster jedisCluster; /** * Redis lock timeout in milliseconds @@ -124,7 +124,7 @@ public RedisJobStore setJedisPool(Pool jedisPool) { } - public RedisJobStore setJedisCluster(JedisClusterCommandsWrapper jedisCluster) { + public RedisJobStore setJedisCluster(JedisCluster jedisCluster) { this.jedisCluster = jedisCluster; return this; } @@ -163,8 +163,8 @@ public void initialize(ClassLoadHelper loadHelper, SchedulerSignaler signaler) t if (redisCluster && jedisCluster == null) { Set nodes = buildNodesSetFromHost(); - JedisPoolConfig jedisPoolConfig = new JedisPoolConfig(); - jedisCluster = new JedisClusterCommandsWrapper(new JedisCluster(nodes, this.conTimeout, this.soTimeout, this.conRetries, this.password,jedisPoolConfig)); + GenericObjectPoolConfig jedisPoolConfig = new ConnectionPoolConfig(); + jedisCluster = new JedisCluster(nodes, this.conTimeout, this.soTimeout, this.conRetries, this.password, jedisPoolConfig); storage = new RedisClusterStorage(redisSchema, mapper, signaler, instanceId, lockTimeout); } else if (jedisPool == null) { JedisPoolConfig jedisPoolConfig = new JedisPoolConfig(); diff --git a/src/main/java/net/joelinn/quartz/jobstore/jedis/JedisClusterCommandsWrapper.java b/src/main/java/net/joelinn/quartz/jobstore/jedis/JedisClusterCommandsWrapper.java deleted file mode 100644 index f1b645d..0000000 --- a/src/main/java/net/joelinn/quartz/jobstore/jedis/JedisClusterCommandsWrapper.java +++ /dev/null @@ -1,906 +0,0 @@ -package net.joelinn.quartz.jobstore.jedis; - -import redis.clients.jedis.*; -import redis.clients.jedis.commands.JedisCommands; -import redis.clients.jedis.params.*; - -import java.util.List; -import java.util.Map; -import java.util.Set; - -/** - * Unfortunately, {@link JedisCluster} does not implement the {@link JedisCommands} interface, even though the vast - * majority of its method signatures line up. This class works around that issue. Hopefully future versions of Jedis - * will render this unnecessary. - * @author Joe Linn - * 7/2/2019 - */ -public class JedisClusterCommandsWrapper implements JedisCommands { - private final JedisCluster cluster; - - public JedisClusterCommandsWrapper(JedisCluster cluster) { - this.cluster = cluster; - } - - - @Override - public String set(String s, String s1) { - return cluster.set(s, s1); - } - - @Override - public String set(String s, String s1, SetParams setParams) { - return cluster.set(s, s1, setParams); - } - - @Override - public String get(String s) { - return cluster.get(s); - } - - @Override - public Boolean exists(String s) { - return cluster.exists(s); - } - - @Override - public Long persist(String s) { - return cluster.persist(s); - } - - @Override - public String type(String s) { - return cluster.type(s); - } - - @Override - public byte[] dump(String s) { - return cluster.dump(s); - } - - @Override - public String restore(String s, int i, byte[] bytes) { - return cluster.restore(s, i, bytes); - } - - @Override - public String restoreReplace(String s, int i, byte[] bytes) { - return null; - } - - @Override - public Long expire(String s, int i) { - return cluster.expire(s, i); - } - - @Override - public Long pexpire(String s, long l) { - return cluster.pexpire(s, l); - } - - @Override - public Long expireAt(String s, long l) { - return cluster.expireAt(s, l); - } - - @Override - public Long pexpireAt(String s, long l) { - return cluster.pexpireAt(s, l); - } - - @Override - public Long ttl(String s) { - return cluster.ttl(s); - } - - @Override - public Long pttl(String s) { - return cluster.pttl(s); - } - - @Override - public Long touch(String s) { - return cluster.touch(s); - } - - @Override - public Boolean setbit(String s, long l, boolean b) { - return cluster.setbit(s, l, b); - } - - @Override - public Boolean setbit(String s, long l, String s1) { - return cluster.setbit(s, l, s1); - } - - @Override - public Boolean getbit(String s, long l) { - return cluster.getbit(s, l); - } - - @Override - public Long setrange(String s, long l, String s1) { - return cluster.setrange(s, l, s1); - } - - @Override - public String getrange(String s, long l, long l1) { - return cluster.getrange(s, l, l1); - } - - @Override - public String getSet(String s, String s1) { - return cluster.getSet(s, s1); - } - - @Override - public Long setnx(String s, String s1) { - return cluster.setnx(s, s1); - } - - @Override - public String setex(String s, int i, String s1) { - return cluster.setex(s, i, s1); - } - - @Override - public String psetex(String s, long l, String s1) { - return cluster.psetex(s, l, s1); - } - - @Override - public Long decrBy(String s, long l) { - return cluster.decrBy(s, l); - } - - @Override - public Long decr(String s) { - return cluster.decr(s); - } - - @Override - public Long incrBy(String s, long l) { - return cluster.incrBy(s, l); - } - - @Override - public Double incrByFloat(String s, double v) { - return cluster.incrByFloat(s, v); - } - - @Override - public Long incr(String s) { - return cluster.incr(s); - } - - @Override - public Long append(String s, String s1) { - return cluster.append(s, s1); - } - - @Override - public String substr(String s, int i, int i1) { - return cluster.substr(s, i, i1); - } - - @Override - public Long hset(String s, String s1, String s2) { - return cluster.hset(s, s1, s2); - } - - @Override - public Long hset(String s, Map map) { - return cluster.hset(s, map); - } - - @Override - public String hget(String s, String s1) { - return cluster.hget(s, s1); - } - - @Override - public Long hsetnx(String s, String s1, String s2) { - return cluster.hsetnx(s, s1, s2); - } - - @Override - public String hmset(String s, Map map) { - return cluster.hmset(s, map); - } - - @Override - public List hmget(String s, String... strings) { - return cluster.hmget(s, strings); - } - - @Override - public Long hincrBy(String s, String s1, long l) { - return cluster.hincrBy(s, s1, l); - } - - @Override - public Double hincrByFloat(String s, String s1, double v) { - return cluster.hincrByFloat(s.getBytes(), s1.getBytes(), v); - } - - @Override - public Boolean hexists(String s, String s1) { - return cluster.hexists(s, s1); - } - - @Override - public Long hdel(String s, String... strings) { - return cluster.hdel(s, strings); - } - - @Override - public Long hlen(String s) { - return cluster.hlen(s); - } - - @Override - public Set hkeys(String s) { - return cluster.hkeys(s); - } - - @Override - public List hvals(String s) { - return cluster.hvals(s); - } - - @Override - public Map hgetAll(String s) { - return cluster.hgetAll(s); - } - - @Override - public Long rpush(String s, String... strings) { - return cluster.rpush(s, strings); - } - - @Override - public Long lpush(String s, String... strings) { - return cluster.lpush(s, strings); - } - - @Override - public Long llen(String s) { - return cluster.llen(s); - } - - @Override - public List lrange(String s, long l, long l1) { - return cluster.lrange(s, l, l1); - } - - @Override - public String ltrim(String s, long l, long l1) { - return cluster.ltrim(s, l, l1); - } - - @Override - public String lindex(String s, long l) { - return cluster.lindex(s, l); - } - - @Override - public String lset(String s, long l, String s1) { - return cluster.lset(s, l, s1); - } - - @Override - public Long lrem(String s, long l, String s1) { - return cluster.lrem(s, l, s1); - } - - @Override - public String lpop(String s) { - return cluster.lpop(s); - } - - @Override - public List lpop(String key, int count) { - return cluster.lpop(key, count); - } - - @Override - public Long lpos(String key, String element) { - return cluster.lpos(key, element); - } - - @Override - public Long lpos(String key, String element, LPosParams params) { - return cluster.lpos(key, element, params); - } - - @Override - public List lpos(String key, String element, LPosParams params, long count) { - return cluster.lpos(key, element, params, count); - } - - @Override - public String rpop(String s) { - return cluster.rpop(s); - } - - @Override - public List rpop(String key, int count) { - return cluster.rpop(key, count); - } - - @Override - public Long sadd(String s, String... strings) { - return cluster.sadd(s, strings); - } - - @Override - public Set smembers(String s) { - return cluster.smembers(s); - } - - @Override - public Long srem(String s, String... strings) { - return cluster.srem(s, strings); - } - - @Override - public String spop(String s) { - return cluster.spop(s); - } - - @Override - public Set spop(String s, long l) { - return cluster.spop(s, l); - } - - @Override - public Long scard(String s) { - return cluster.scard(s); - } - - @Override - public Boolean sismember(String s, String s1) { - return cluster.sismember(s, s1); - } - - @Override - public List smismember(String key, String... members) { - return null; - } - - @Override - public String srandmember(String s) { - return cluster.srandmember(s); - } - - @Override - public List srandmember(String s, int i) { - return cluster.srandmember(s, i); - } - - @Override - public Long strlen(String s) { - return cluster.strlen(s); - } - - @Override - public Long zadd(String s, double v, String s1) { - return cluster.zadd(s, v, s1); - } - - @Override - public Long zadd(String s, double v, String s1, ZAddParams zAddParams) { - return cluster.zadd(s, v, s1, zAddParams); - } - - @Override - public Long zadd(String s, Map map) { - return cluster.zadd(s, map); - } - - @Override - public Long zadd(String s, Map map, ZAddParams zAddParams) { - return cluster.zadd(s, map, zAddParams); - } - - @Override - public Set zrange(String s, long l, long l1) { - return cluster.zrange(s, l, l1); - } - - @Override - public Long zrem(String s, String... strings) { - return cluster.zrem(s, strings); - } - - @Override - public Double zincrby(String s, double v, String s1) { - return cluster.zincrby(s, v, s1); - } - - @Override - public Double zincrby(String s, double v, String s1, ZIncrByParams zIncrByParams) { - return cluster.zincrby(s, v, s1, zIncrByParams); - } - - @Override - public Long zrank(String s, String s1) { - return cluster.zrank(s, s1); - } - - @Override - public Long zrevrank(String s, String s1) { - return cluster.zrevrank(s, s1); - } - - @Override - public Set zrevrange(String s, long l, long l1) { - return cluster.zrevrange(s, l, l1); - } - - @Override - public Set zrangeWithScores(String s, long l, long l1) { - return cluster.zrangeWithScores(s, l, l1); - } - - @Override - public Set zrevrangeWithScores(String s, long l, long l1) { - return cluster.zrevrangeWithScores(s, l, l1); - } - - @Override - public Long zcard(String s) { - return cluster.zcard(s); - } - - @Override - public Double zscore(String s, String s1) { - return cluster.zscore(s, s1); - } - - @Override - public List zmscore(String key, String... members) { - return null; - } - - @Override - public List sort(String s) { - return cluster.sort(s); - } - - @Override - public List sort(String s, SortingParams sortingParams) { - return cluster.sort(s, sortingParams); - } - - @Override - public Long zcount(String s, double v, double v1) { - return cluster.zcount(s, v, v1); - } - - @Override - public Long zcount(String s, String s1, String s2) { - return cluster.zcount(s, s1, s1); - } - - @Override - public Set zrangeByScore(String s, double v, double v1) { - return cluster.zrangeByScore(s, v, v1); - } - - @Override - public Set zrangeByScore(String s, String s1, String s2) { - return cluster.zrangeByScore(s, s1, s2); - } - - @Override - public Set zrevrangeByScore(String s, double v, double v1) { - return cluster.zrevrangeByScore(s, v, v1); - } - - @Override - public Set zrangeByScore(String s, double v, double v1, int i, int i1) { - return cluster.zrangeByScore(s, v, v1, i, i1); - } - - @Override - public Set zrevrangeByScore(String s, String s1, String s2) { - return cluster.zrevrangeByScore(s, s1, s2); - } - - @Override - public Set zrangeByScore(String s, String s1, String s2, int i, int i1) { - return cluster.zrangeByScore(s, s1, s2, i, i1); - } - - @Override - public Set zrevrangeByScore(String s, double v, double v1, int i, int i1) { - return cluster.zrevrangeByScore(s, v, v1, i, i1); - } - - @Override - public Set zrangeByScoreWithScores(String s, double v, double v1) { - return cluster.zrangeByScoreWithScores(s, v, v1); - } - - @Override - public Set zrevrangeByScoreWithScores(String s, double v, double v1) { - return cluster.zrevrangeByScoreWithScores(s, v, v1); - } - - @Override - public Set zrangeByScoreWithScores(String s, double v, double v1, int i, int i1) { - return cluster.zrangeByScoreWithScores(s, v, v1, i, i1); - } - - @Override - public Set zrevrangeByScore(String s, String s1, String s2, int i, int i1) { - return cluster.zrevrangeByScore(s, s1, s2, i, i1); - } - - @Override - public Set zrangeByScoreWithScores(String s, String s1, String s2) { - return cluster.zrangeByScoreWithScores(s, s1, s2); - } - - @Override - public Set zrevrangeByScoreWithScores(String s, String s1, String s2) { - return cluster.zrevrangeByScoreWithScores(s, s1, s2); - } - - @Override - public Set zrangeByScoreWithScores(String s, String s1, String s2, int i, int i1) { - return cluster.zrangeByScoreWithScores(s, s1, s2, i , i1); - } - - @Override - public Set zrevrangeByScoreWithScores(String s, double v, double v1, int i, int i1) { - return cluster.zrevrangeByScoreWithScores(s, v, v1, i, i1); - } - - @Override - public Set zrevrangeByScoreWithScores(String s, String s1, String s2, int i, int i1) { - return cluster.zrevrangeByScoreWithScores(s, s1, s2, i, i1); - } - - @Override - public Long zremrangeByRank(String s, long l, long l1) { - return cluster.zremrangeByRank(s, l, l1); - } - - @Override - public Long zremrangeByScore(String s, double v, double v1) { - return cluster.zremrangeByScore(s, v, v1); - } - - @Override - public Long zremrangeByScore(String s, String s1, String s2) { - return cluster.zremrangeByScore(s, s1, s2); - } - - @Override - public Long zlexcount(String s, String s1, String s2) { - return cluster.zlexcount(s, s1, s2); - } - - @Override - public Set zrangeByLex(String s, String s1, String s2) { - return cluster.zrangeByLex(s, s1, s2); - } - - @Override - public Set zrangeByLex(String s, String s1, String s2, int i, int i1) { - return cluster.zrangeByLex(s, s1, s2, i, i1); - } - - @Override - public Set zrevrangeByLex(String s, String s1, String s2) { - return cluster.zrevrangeByLex(s, s1, s2); - } - - @Override - public Set zrevrangeByLex(String s, String s1, String s2, int i, int i1) { - return cluster.zrevrangeByLex(s, s1, s2, i, i1); - } - - @Override - public Long zremrangeByLex(String s, String s1, String s2) { - return cluster.zremrangeByLex(s, s1, s2); - } - - @Override - public Long linsert(String s, ListPosition listPosition, String s1, String s2) { - return cluster.linsert(s, listPosition, s1, s2); - } - - @Override - public Long lpushx(String s, String... strings) { - return cluster.lpushx(s, strings); - } - - @Override - public Long rpushx(String s, String... strings) { - return cluster.rpushx(s, strings); - } - - @Override - public List blpop(int i, String s) { - return cluster.blpop(i, s); - } - - @Override - public List brpop(int i, String s) { - return cluster.brpop(i, s); - } - - @Override - public Long del(String s) { - return cluster.del(s); - } - - @Override - public Long unlink(String s) { - return cluster.unlink(s); - } - - @Override - public String echo(String s) { - return cluster.echo(s); - } - - @Override - public Long move(String s, int i) { - throw new UnsupportedOperationException(); - } - - @Override - public Long bitcount(String s) { - return cluster.bitcount(s); - } - - @Override - public Long bitcount(String s, long l, long l1) { - return cluster.bitcount(s, l, l1); - } - - @Override - public Long bitpos(String s, boolean b) { - throw new UnsupportedOperationException(); - } - - @Override - public Long bitpos(String s, boolean b, BitPosParams bitPosParams) { - throw new UnsupportedOperationException(); - } - - @Override - public ScanResult> hscan(String s, String s1) { - return cluster.hscan(s, s1); - } - - @Override - public ScanResult> hscan(String s, String s1, ScanParams scanParams) { - throw new UnsupportedOperationException(); - } - - @Override - public ScanResult sscan(String s, String s1) { - return cluster.sscan(s, s1); - } - - @Override - public ScanResult zscan(String s, String s1) { - return cluster.zscan(s, s1); - } - - @Override - public ScanResult zscan(String s, String s1, ScanParams scanParams) { - return cluster.zscan(s.getBytes(), s1.getBytes(), scanParams); - } - - @Override - public ScanResult sscan(String s, String s1, ScanParams scanParams) { - throw new UnsupportedOperationException(); - } - - @Override - public Long pfadd(String s, String... strings) { - return cluster.pfadd(s, strings); - } - - @Override - public long pfcount(String s) { - return cluster.pfcount(s); - } - - @Override - public Long geoadd(String s, double v, double v1, String s1) { - return cluster.geoadd(s, v, v1, s1); - } - - @Override - public Long geoadd(String s, Map map) { - return cluster.geoadd(s, map); - } - - @Override - public Double geodist(String s, String s1, String s2) { - return cluster.geodist(s, s1, s2); - } - - @Override - public Double geodist(String s, String s1, String s2, GeoUnit geoUnit) { - return cluster.geodist(s, s1, s2, geoUnit); - } - - @Override - public List geohash(String s, String... strings) { - return cluster.geohash(s, strings); - } - - @Override - public List geopos(String s, String... strings) { - return cluster.geopos(s, strings); - } - - @Override - public List georadius(String s, double v, double v1, double v2, GeoUnit geoUnit) { - return cluster.georadius(s, v, v1, v2, geoUnit); - } - - @Override - public List georadiusReadonly(String s, double v, double v1, double v2, GeoUnit geoUnit) { - return cluster.georadiusReadonly(s, v, v1, v2, geoUnit); - } - - @Override - public List georadius(String s, double v, double v1, double v2, GeoUnit geoUnit, GeoRadiusParam geoRadiusParam) { - return cluster.georadiusReadonly(s, v, v1, v2, geoUnit, geoRadiusParam); - } - - @Override - public List georadiusReadonly(String s, double v, double v1, double v2, GeoUnit geoUnit, GeoRadiusParam geoRadiusParam) { - return cluster.georadiusReadonly(s, v, v1, v2, geoUnit, geoRadiusParam); - } - - @Override - public List georadiusByMember(String s, String s1, double v, GeoUnit geoUnit) { - return cluster.georadiusByMember(s, s1, v, geoUnit); - } - - @Override - public List georadiusByMemberReadonly(String s, String s1, double v, GeoUnit geoUnit) { - return cluster.georadiusByMemberReadonly(s, s1, v, geoUnit); - } - - @Override - public List georadiusByMember(String s, String s1, double v, GeoUnit geoUnit, GeoRadiusParam geoRadiusParam) { - return cluster.georadiusByMember(s, s1, v, geoUnit, geoRadiusParam); - } - - @Override - public List georadiusByMemberReadonly(String s, String s1, double v, GeoUnit geoUnit, GeoRadiusParam geoRadiusParam) { - return cluster.georadiusByMemberReadonly(s, s1, v, geoUnit, geoRadiusParam); - } - - @Override - public List bitfield(String s, String... strings) { - return cluster.bitfield(s, strings); - } - - @Override - public Long hstrlen(String s, String s1) { - return cluster.hstrlen(s, s1); - } - - - @Override - public Tuple zpopmax(String key) { - return cluster.zpopmax(key); - } - - @Override - public Set zpopmax(String key, int count) { - return cluster.zpopmax(key, count); - } - - @Override - public Tuple zpopmin(String key) { - return cluster.zpopmin(key); - } - - @Override - public Set zpopmin(String key, int count) { - return cluster.zpopmin(key, count); - } - - @Override - public List bitfieldReadonly(String key, String... arguments) { - return cluster.bitfieldReadonly(key, arguments); - } - - @Override - public StreamEntryID xadd(String key, StreamEntryID id, Map hash) { - return cluster.xadd(key, id, hash); - } - - @Override - public StreamEntryID xadd(String key, StreamEntryID id, Map hash, long maxLen, boolean approximateLength) { - return cluster.xadd(key, id, hash, maxLen, approximateLength); - } - - @Override - public Long xlen(String key) { - return cluster.xlen(key); - } - - @Override - public List xrange(String key, StreamEntryID start, StreamEntryID end, int count) { - return cluster.xrange(key, start, end, count); - } - - @Override - public List xrevrange(String key, StreamEntryID end, StreamEntryID start, int count) { - return cluster.xrevrange(key, end, start, count); - } - - @Override - public long xack(String key, String group, StreamEntryID... ids) { - return cluster.xack(key, group, ids); - } - - @Override - public String xgroupCreate(String key, String groupname, StreamEntryID id, boolean makeStream) { - return cluster.xgroupCreate(key, groupname, id, makeStream); - } - - @Override - public String xgroupSetID(String key, String groupname, StreamEntryID id) { - return cluster.xgroupSetID(key, groupname, id); - } - - @Override - public long xgroupDestroy(String key, String groupname) { - return cluster.xgroupDestroy(key, groupname); - } - - @Override - public Long xgroupDelConsumer(String key, String groupname, String consumername) { - return cluster.xgroupDelConsumer(key, groupname, consumername); - } - - @Override - public List xpending(String key, String groupname, StreamEntryID start, StreamEntryID end, int count, String consumername) { - return cluster.xpending(key, groupname, start, end, count, consumername); - } - - @Override - public long xdel(String key, StreamEntryID... ids) { - return cluster.xdel(key, ids); - } - - @Override - public long xtrim(String key, long maxLen, boolean approximate) { - return cluster.xtrim(key, maxLen, approximate); - } - - @Override - public List xclaim(String key, String group, String consumername, long minIdleTime, long newIdleTime, int retries, boolean force, StreamEntryID... ids) { - return cluster.xclaim(key, group, consumername, minIdleTime, newIdleTime, retries, force, ids); - } - - @Override - public StreamInfo xinfoStream(String key) { - throw new UnsupportedOperationException("xinfoStream not supported."); - } - - @Override - public List xinfoGroup(String key) { - throw new UnsupportedOperationException("xinfoGroup not supported."); - } - - @Override - public List xinfoConsumers(String key, String group) { - throw new UnsupportedOperationException("xinfoConsumers not supported"); - } -} diff --git a/src/test/java/net/joelinn/quartz/MultiSchedulerIntegrationTest.java b/src/test/java/net/joelinn/quartz/MultiSchedulerIntegrationTest.java index 636d9d1..89ac59c 100644 --- a/src/test/java/net/joelinn/quartz/MultiSchedulerIntegrationTest.java +++ b/src/test/java/net/joelinn/quartz/MultiSchedulerIntegrationTest.java @@ -94,7 +94,7 @@ public void testMultipleSchedulers() throws Exception { scheduler.getListenerManager().addTriggerListener(new CompleteListener(waiter), NameMatcher.triggerNameEquals(triggerName)); scheduler.scheduleJob(job, trigger); - waiter.await(3000); + waiter.await(5000); try (Jedis jedis = jedisPool.getResource()) { assertThat(jedis.get(KEY_ID), equalTo(scheduler.getSchedulerInstanceId())); @@ -108,7 +108,7 @@ public void testMultipleSchedulers() throws Exception { } scheduler2.start(); - waiter.await(3000); + waiter.await(5000); try (Jedis jedis = jedisPool.getResource()) { assertThat(jedis.get(KEY_ID), equalTo(scheduler2.getSchedulerInstanceId())); @@ -140,7 +140,7 @@ public void testDeadScheduler() throws Exception { jobStartWaiter = new Waiter(); scheduler.scheduleJob(job, trigger); - jobStartWaiter.await(1500, TimeUnit.MILLISECONDS); + jobStartWaiter.await(3000, TimeUnit.MILLISECONDS); scheduler.shutdown(false); getThreadByName(jobThreadName).interrupt(); @@ -154,7 +154,7 @@ public void testDeadScheduler() throws Exception { } scheduler2.start(); - jobStartWaiter.await(1500, TimeUnit.MILLISECONDS); + jobStartWaiter.await(3000, TimeUnit.MILLISECONDS); getThreadByName(jobThreadName).interrupt(); diff --git a/src/test/java/net/joelinn/quartz/MultiThreadedIntegrationTest.java b/src/test/java/net/joelinn/quartz/MultiThreadedIntegrationTest.java index 0b8a1da..564f67a 100644 --- a/src/test/java/net/joelinn/quartz/MultiThreadedIntegrationTest.java +++ b/src/test/java/net/joelinn/quartz/MultiThreadedIntegrationTest.java @@ -40,7 +40,7 @@ public void testCompleteListener() throws Exception { scheduler.getListenerManager().addTriggerListener(new CompleteListener(waiter), NameMatcher.triggerNameEquals(triggerName)); // wait for CompleteListener.triggerComplete() to be called - waiter.await(1500); + waiter.await(3000); } @@ -61,14 +61,14 @@ public void testTriggerData() throws Exception { scheduler.getListenerManager().addTriggerListener(new CompleteListener(waiter), NameMatcher.triggerNameEquals(triggerName)); // wait for CompleteListener.triggerComplete() to be called - waiter.await(1500); + waiter.await(3000); try (Jedis jedis = jedisPool.getResource()) { assertThat(jedis.get("foo"), equalTo("bar")); } } - - + + @Test public void testDisallowConcurrent() throws Exception { JobDetail job1 = createJob(SingletonSleepJob.class, "job1", "group1"); diff --git a/src/test/java/net/joelinn/quartz/SingleThreadedIntegrationTest.java b/src/test/java/net/joelinn/quartz/SingleThreadedIntegrationTest.java index 2b835bb..f78c7a9 100644 --- a/src/test/java/net/joelinn/quartz/SingleThreadedIntegrationTest.java +++ b/src/test/java/net/joelinn/quartz/SingleThreadedIntegrationTest.java @@ -36,7 +36,7 @@ public void testMisfireListener() throws Exception { scheduler.getListenerManager().addTriggerListener(new MisfireListener(waiter), NameMatcher.triggerNameEquals(triggerName)); // wait for MisfireListener.triggerMisfired() to be called - waiter.await(2500); + waiter.await(3000); } @@ -52,6 +52,6 @@ public void testSingleExecution() throws Exception { scheduler.scheduleJob(jobDetail, trigger); - waiter.await(2000); + waiter.await(3000); } }