From ec451d56e52c1d05043d158d2ecfea2228bc1222 Mon Sep 17 00:00:00 2001 From: mohammed jasem alaajel <34905970+ham1255@users.noreply.github.com> Date: Thu, 30 Jul 2020 09:35:50 +0400 Subject: [PATCH] small fix to make sure the connect was killed --- pom.xml | 2 +- src/main/java/net/limework/core/managers/RedisManager.java | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 5287a77..5ee9fc6 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ net.limework.core LimeworkSpigotCore - 1.0.3-fix1-SNAPSHOT + 1.0.3-fix2-SNAPSHOT jar diff --git a/src/main/java/net/limework/core/managers/RedisManager.java b/src/main/java/net/limework/core/managers/RedisManager.java index c10f4b4..30df393 100644 --- a/src/main/java/net/limework/core/managers/RedisManager.java +++ b/src/main/java/net/limework/core/managers/RedisManager.java @@ -32,6 +32,8 @@ public class RedisManager extends BinaryJedisPubSub implements Runnable, Command private JedisPool jedisPool; private ExecutorService RedisService; + private AtomicBoolean isKilled = new AtomicBoolean(); + //sub private BinaryJedis subscribeJedis; @@ -72,6 +74,7 @@ public class RedisManager extends BinaryJedisPubSub implements Runnable, Command @Override public void run() { while (!isShuttingDown.get()) { + isKilled.set(false); try { message("&e[Jedis] &cConnecting to redis..........."); if (!this.subscribeJedis.isConnected()) this.subscribeJedis = this.jedisPool.getResource(); @@ -110,6 +113,7 @@ public class RedisManager extends BinaryJedisPubSub implements Runnable, Command } catch (InterruptedException e) { e.printStackTrace(); } + if (isKilled.get()) break; } } @@ -179,6 +183,7 @@ public class RedisManager extends BinaryJedisPubSub implements Runnable, Command , "&c&lYou can not execute this command!!!!!!"))); return true; } + isKilled.set(true); try { if (this.subscribeJedis != null) { this.unsubscribe();