This commit is contained in:
ham1255 2020-05-18 01:57:36 +04:00
parent 68589c37a0
commit b6a8b5005c
3 changed files with 6 additions and 4 deletions

View File

@ -8,6 +8,8 @@
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="61139119-6327-48a6-9183-0df6346ed8d8" name="Default Changelist" comment=""> <list default="true" id="61139119-6327-48a6-9183-0df6346ed8d8" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/net/limework/skLimework/AddonPlugin.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/net/limework/skLimework/AddonPlugin.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/net/limework/skLimework/Events/RedisSub.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/net/limework/skLimework/Events/RedisSub.java" afterDir="false" />
</list> </list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" /> <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />

View File

@ -77,8 +77,8 @@ public class AddonPlugin extends JavaPlugin {
public void onDisable(){ public void onDisable(){
redisSub.shutdown(); redisSub.shutdown();
service.shutdown(); service.shutdown();
try { service.awaitTermination(Long.MAX_VALUE, TimeUnit.NANOSECONDS); } catch (InterruptedException e) { e.printStackTrace(); } try { service.awaitTermination(3, TimeUnit.SECONDS); } catch (InterruptedException e) { e.printStackTrace(); }
jedisPool.close(); jedisPool.close();
} }
public AddonPlugin getInstance() { public AddonPlugin getInstance() {

View File

@ -27,7 +27,7 @@ public class RedisSub extends JedisPubSub implements Runnable{
public void run(){ public void run(){
try{ try{
this.j.subscribe(this, channels); this.j.subscribe(this, channels);
} catch (JedisConnectionException je){ } catch (Exception je){
plugin.getLogger().warning("Lost connection to redis!"); plugin.getLogger().warning("Lost connection to redis!");
newJedis(); newJedis();
} }
@ -43,7 +43,7 @@ public class RedisSub extends JedisPubSub implements Runnable{
this.j = plugin.getJedisPool().getResource(); this.j = plugin.getJedisPool().getResource();
plugin.getLogger().info("Connected!"); plugin.getLogger().info("Connected!");
break; break;
}catch (JedisConnectionException e){ }catch (Exception e){
plugin.getLogger().warning("reconnecting to Redis has Failed! retrying in 4 seconds!"); plugin.getLogger().warning("reconnecting to Redis has Failed! retrying in 4 seconds!");
try { Thread.sleep(4000);}catch (InterruptedException ignored){} try { Thread.sleep(4000);}catch (InterruptedException ignored){}
} }