From c404a8526c412e80d4dabf6cf8200ae48c288036 Mon Sep 17 00:00:00 2001 From: ZEEKLING Date: Sun, 19 Dec 2021 14:28:20 +0800 Subject: [PATCH] Replace deprecated interface with new interface of JedisPoolConfig (#2749) * Replace old interface with new interface of JedisPoolConfig * Replace old interface with new interface of ConnectionPoolConfig * reorder import * reorder import Co-authored-by: M Sazzadul Hoque <7600764+sazzad16@users.noreply.github.com> --- src/main/java/redis/clients/jedis/ConnectionPoolConfig.java | 5 +++-- src/main/java/redis/clients/jedis/JedisPoolConfig.java | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/java/redis/clients/jedis/ConnectionPoolConfig.java b/src/main/java/redis/clients/jedis/ConnectionPoolConfig.java index 48ea4942e0..4525678511 100644 --- a/src/main/java/redis/clients/jedis/ConnectionPoolConfig.java +++ b/src/main/java/redis/clients/jedis/ConnectionPoolConfig.java @@ -1,5 +1,6 @@ package redis.clients.jedis; +import java.time.Duration; import org.apache.commons.pool2.impl.GenericObjectPoolConfig; public class ConnectionPoolConfig extends GenericObjectPoolConfig { @@ -7,8 +8,8 @@ public class ConnectionPoolConfig extends GenericObjectPoolConfig { public ConnectionPoolConfig() { // defaults to make your life with connection pool easier :) setTestWhileIdle(true); - setMinEvictableIdleTimeMillis(60000); - setTimeBetweenEvictionRunsMillis(30000); + setMinEvictableIdleTime(Duration.ofMillis(60000)); + setTimeBetweenEvictionRuns(Duration.ofMillis(30000)); setNumTestsPerEvictionRun(-1); } } diff --git a/src/main/java/redis/clients/jedis/JedisPoolConfig.java b/src/main/java/redis/clients/jedis/JedisPoolConfig.java index c88364bf4f..476d2e3f09 100644 --- a/src/main/java/redis/clients/jedis/JedisPoolConfig.java +++ b/src/main/java/redis/clients/jedis/JedisPoolConfig.java @@ -1,5 +1,6 @@ package redis.clients.jedis; +import java.time.Duration; import org.apache.commons.pool2.impl.GenericObjectPoolConfig; public class JedisPoolConfig extends GenericObjectPoolConfig { @@ -7,8 +8,8 @@ public class JedisPoolConfig extends GenericObjectPoolConfig { public JedisPoolConfig() { // defaults to make your life with connection pool easier :) setTestWhileIdle(true); - setMinEvictableIdleTimeMillis(60000); - setTimeBetweenEvictionRunsMillis(30000); + setMinEvictableIdleTime(Duration.ofMillis(60000)); + setTimeBetweenEvictionRuns(Duration.ofMillis(30000)); setNumTestsPerEvictionRun(-1); } }