Skip to content

fix retry polling when Jedis Connection error happens #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ redis-scheduler
===============

Distributed Scheduler using Redis for Java applications.
[fork redis-scheduler 3.0.0 by David Marquis](https://github.com/davidmarquis/redis-scheduler)

What is this?
-------------
Expand Down
13 changes: 13 additions & 0 deletions RELEASENOTE..md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# 3.0.2

### features
- update version to run with springboot 3.1

# 3.0.1

### features
- fix retry polling when Jedis Connection error happens

# 3.0.0
[fork redis-scheduler 3.0.0 by David Marquis](https://github.com/davidmarquis/redis-scheduler)

78 changes: 46 additions & 32 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.github.davidmarquis</groupId>
<groupId>io.github.christianmelon</groupId>
<artifactId>redis-scheduler</artifactId>
<version>3.0.1-SNAPSHOT</version>
<version>3.0.2</version>
<packaging>jar</packaging>

<name>redis-scheduler</name>
<description>Java implementation of a lightweight distributed task scheduler backed by Redis</description>
<url>https://github.com/davidmarquis/redis-scheduler</url>
<description>fork : Java implementation of a lightweight distributed task scheduler backed by Redis</description>
<url>https://github.com/christianmelon/redis-scheduler</url>

<licenses>
<license>
Expand All @@ -20,92 +20,99 @@
</licenses>

<scm>
<connection>scm:git:git@github.com:davidmarquis/redis-scheduler.git</connection>
<developerConnection>scm:git:git@github.com:davidmarquis/redis-scheduler.git</developerConnection>
<url>git@github.com:davidmarquis/redis-scheduler.git</url>
<connection>scm:git:git@github.com:christianmelon/redis-scheduler.git</connection>
<developerConnection>scm:git:git@github.com:christianmelon/redis-scheduler.git</developerConnection>
<url>git@github.com:christianmelon/redis-scheduler.git</url>
<tag>HEAD</tag>
</scm>

<developers>
<developer>
<id>davidmarquis</id>
<name>David Marquis</name>
<email>david@radiant3.ca</email>
<id>christianmelon</id>
<name>Christian Melon</name>
<email>christian.melon@orange.com</email>
</developer>
</developers>

<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>ossrh</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
<java.version>17</java.version>
</properties>

<dependencies>
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>1.3.1</version>
<version>1.3.2</version>
</dependency>

<!-- Lettuce driver -->
<dependency>
<groupId>io.lettuce</groupId>
<artifactId>lettuce-core</artifactId>
<version>5.0.3.RELEASE</version>
<version>6.2.5.RELEASE</version>
<scope>provided</scope>
</dependency>

<!-- Jedis driver -->
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>2.9.0</version>
<version>4.3.2</version>
<scope>provided</scope>
</dependency>

<!-- Spring Data Redis driver -->
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-redis</artifactId>
<version>1.8.11.RELEASE</version>
<version>3.1.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-pool2</artifactId>
<version>2.2</version>
<version>2.11.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>4.3.15.RELEASE</version>
<version>6.0.11</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>4.3.15.RELEASE</version>
<version>6.0.11</version>
<scope>test</scope>
</dependency>

<!-- Tests -->
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.2.3</version>
<version>1.4.8</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>2.0.7</version>
</dependency>

<dependency>
<groupId>com.github.kstyrc</groupId>
<artifactId>embedded-redis</artifactId>
Expand All @@ -115,7 +122,7 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<version>4.13.2</version>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -126,8 +133,15 @@
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.9.5</version>
<artifactId>mockito-core</artifactId>
<version>4.8.1</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-junit-jupiter</artifactId>
<version>4.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand All @@ -146,7 +160,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.2.1</version>
<version>3.2.0</version>
<executions>
<execution>
<id>attach-sources</id>
Expand All @@ -159,7 +173,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.0.0</version>
<version>3.4.1</version>
<executions>
<execution>
<id>attach-javadocs</id>
Expand All @@ -172,7 +186,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.5</version>
<version>3.0.1</version>
<executions>
<execution>
<id>sign-artifacts</id>
Expand Down Expand Up @@ -202,7 +216,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<version>3.11.0</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
Expand All @@ -211,7 +225,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.3</version>
<version>3.0.0</version>
<configuration>
<autoVersionSubmodules>true</autoVersionSubmodules>
<useReleaseProfile>false</useReleaseProfile>
Expand All @@ -222,11 +236,11 @@
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.7</version>
<version>1.6.8</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
Expand All @@ -244,4 +258,4 @@
</testResources>
</build>

</project>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import redis.clients.jedis.exceptions.JedisConnectionException;

class PollingThread extends Thread {

Expand Down Expand Up @@ -60,9 +61,10 @@ private void attemptTriggerNextTask() throws InterruptedException {
}

resetRetriesAttemptsCount();
} catch (RedisConnectException e) {
} catch (RedisConnectException | JedisConnectionException e) {
incrementRetriesAttemptsCount();
log.warn(String.format("Connection failure during scheduler polling (attempt %s/%s)", numRetriesAttempted, maxRetriesOnConnectionFailure));
sleep(pollingDelayMillis);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public boolean exec() {
} finally {
try {
txn.close();
} catch (IOException e) {
} catch (Exception e) {
throw new RedisConnectException(e);
}
txn = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.mockito.junit.MockitoJUnitRunner;


import java.util.function.Function;

import static org.mockito.Matchers.any;
import static org.mockito.Mockito.*;
import static org.mockito.internal.verification.VerificationModeFactory.atLeast;
import static org.mockito.internal.verification.VerificationModeFactory.times;
Expand Down