Fix rare error on disable

This commit is contained in:
Govindas 2020-11-25 13:18:23 +02:00
parent cf9da45f5d
commit 13ce7d90c4

View File

@ -70,7 +70,7 @@ public class RedisManager extends BinaryJedisPubSub implements Runnable {
@Override @Override
public void run() { public void run() {
while (!isShuttingDown.get()) { while (!isShuttingDown.get() && plugin.isEnabled()) {
try { try {
plugin.getLogger().info(ChatColor.translateAlternateColorCodes('&', "&cConnecting to redis...")); plugin.getLogger().info(ChatColor.translateAlternateColorCodes('&', "&cConnecting to redis..."));
if (!this.subscribeJedis.isConnected()) this.subscribeJedis = this.jedisPool.getResource(); if (!this.subscribeJedis.isConnected()) this.subscribeJedis = this.jedisPool.getResource();
@ -155,6 +155,7 @@ public class RedisManager extends BinaryJedisPubSub implements Runnable {
this.subscribeJedis.getClient().close(); this.subscribeJedis.getClient().close();
this.jedisPool.getResource().close(); this.jedisPool.getResource().close();
} }
isShuttingDown.set(true);
this.RedisReconnector.shutdown(); this.RedisReconnector.shutdown();
this.RedisService.shutdown(); this.RedisService.shutdown();
this.RedisService = null; this.RedisService = null;