From 6c5d580b16a3bcdbb04f57efdbf1e0031bca1d17 Mon Sep 17 00:00:00 2001 From: mohammed jasem alaajel <34905970+ham1255@users.noreply.github.com> Date: Fri, 23 Oct 2020 20:45:53 +0400 Subject: [PATCH] Update RedisManager.java --- .../java/net/limework/core/managers/RedisManager.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/limework/core/managers/RedisManager.java b/src/main/java/net/limework/core/managers/RedisManager.java index 67b7257..3eebfa1 100644 --- a/src/main/java/net/limework/core/managers/RedisManager.java +++ b/src/main/java/net/limework/core/managers/RedisManager.java @@ -60,6 +60,9 @@ public class RedisManager extends BinaryJedisPubSub implements Runnable { } public void start() { + if (isShuttingDown.get()) { + isShuttingDown.set(false); + } this.RedisService.execute(this); } @@ -148,9 +151,10 @@ public class RedisManager extends BinaryJedisPubSub implements Runnable { this.RedisService.shutdown(); } + public void reload() { + shutdown(); plugin.reloadConfig(); - subscribeJedis.close(); Configuration config = this.plugin.getConfig(); JedisPoolConfig JConfig = new JedisPoolConfig(); JConfig.setMaxTotal(config.getInt("Redis.MaxConnections")); @@ -163,7 +167,7 @@ public class RedisManager extends BinaryJedisPubSub implements Runnable { config.getInt("Redis.TimeOut"), config.getString("Redis.Password"), config.getBoolean("Redis.useSSL")); - RedisService.shutdownNow(); + RedisService.shutdown(); RedisService = Executors.newFixedThreadPool(config.getInt("Redis.Threads")); try { this.subscribeJedis = this.jedisPool.getResource(); @@ -171,6 +175,7 @@ public class RedisManager extends BinaryJedisPubSub implements Runnable { } this.channels = config.getStringList("Channels"); encryption = new Encryption(config); + start(); } public JedisPool getJedisPool() {