Fix rare error on disable

This commit is contained in:
Govindass 2020-11-25 13:18:23 +02:00
parent ca64ec19db
commit afdb0c3e59

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;