2
0
mirror of https://github.com/proxiodev/RedisBungee.git synced 2025-04-20 01:27:07 +00:00

send startup / shutdown logs for both Bungeecord and Velocity

This commit is contained in:
mohammed jasem alaajel 2023-04-25 10:59:44 +04:00
parent eac00e1cd2
commit 6eceec4425
No known key found for this signature in database
2 changed files with 9 additions and 1 deletions

View File

@ -198,6 +198,7 @@ public class RedisBungee extends Plugin implements RedisBungeePlugin<ProxiedPlay
@Override @Override
public void initialize() { public void initialize() {
logInfo("Initializing RedisBungee.....");
ThreadFactory factory = ((ThreadPoolExecutor) getExecutorService()).getThreadFactory(); ThreadFactory factory = ((ThreadPoolExecutor) getExecutorService()).getThreadFactory();
ScheduledExecutorService service = Executors.newScheduledThreadPool(24, factory); ScheduledExecutorService service = Executors.newScheduledThreadPool(24, factory);
try { try {
@ -266,10 +267,12 @@ public class RedisBungee extends Plugin implements RedisBungeePlugin<ProxiedPlay
getProxy().getPluginManager().registerCommand(this, new RedisBungeeCommands.PlayerProxyCommand(this)); getProxy().getPluginManager().registerCommand(this, new RedisBungeeCommands.PlayerProxyCommand(this));
getProxy().getPluginManager().registerCommand(this, new RedisBungeeCommands.PlistCommand(this)); getProxy().getPluginManager().registerCommand(this, new RedisBungeeCommands.PlistCommand(this));
} }
logInfo("RedisBungee initialized successfully ");
} }
@Override @Override
public void stop() { public void stop() {
logInfo("Turning off redis connections.....");
// Poison the PubSub listener // Poison the PubSub listener
if (psl != null) { if (psl != null) {
psl.poison(); psl.poison();
@ -287,7 +290,7 @@ public class RedisBungee extends Plugin implements RedisBungeePlugin<ProxiedPlay
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
logInfo("RedisBungee shutdown");
} }
@Override @Override

View File

@ -245,6 +245,7 @@ public class RedisBungeeVelocityPlugin implements RedisBungeePlugin<Player>, Con
@Override @Override
public void initialize() { public void initialize() {
logInfo("Initializing RedisBungee.....");
updateProxiesIds(); updateProxiesIds();
// start heartbeat task // start heartbeat task
heartbeatTask = getProxy().getScheduler().buildTask(this, new HeartbeatTask(this, this.globalPlayerCount)).repeat(HeartbeatTask.INTERVAL, HeartbeatTask.REPEAT_INTERVAL_TIME_UNIT).schedule(); heartbeatTask = getProxy().getScheduler().buildTask(this, new HeartbeatTask(this, this.globalPlayerCount)).repeat(HeartbeatTask.INTERVAL, HeartbeatTask.REPEAT_INTERVAL_TIME_UNIT).schedule();
@ -283,10 +284,12 @@ public class RedisBungeeVelocityPlugin implements RedisBungeePlugin<Player>, Con
getProxy().getCommandManager().register("ip", new RedisBungeeCommands.IpCommand(this), "playerip", "rip", "rplayerip"); getProxy().getCommandManager().register("ip", new RedisBungeeCommands.IpCommand(this), "playerip", "rip", "rplayerip");
getProxy().getCommandManager().register("find", new RedisBungeeCommands.FindCommand(this), "rfind"); getProxy().getCommandManager().register("find", new RedisBungeeCommands.FindCommand(this), "rfind");
} }
logInfo("RedisBungee initialized successfully ");
} }
@Override @Override
public void stop() { public void stop() {
logInfo("Turning off redis connections.....");
// Poison the PubSub listener // Poison the PubSub listener
if (psl != null) { if (psl != null) {
psl.poison(); psl.poison();
@ -306,10 +309,12 @@ public class RedisBungeeVelocityPlugin implements RedisBungeePlugin<Player>, Con
this.httpClient.getDispatcher().getExecutorService().shutdown(); this.httpClient.getDispatcher().getExecutorService().shutdown();
try { try {
logInfo("waiting for httpclient thread-pool termination.....");
this.httpClient.getDispatcher().getExecutorService().awaitTermination(20, TimeUnit.SECONDS); this.httpClient.getDispatcher().getExecutorService().awaitTermination(20, TimeUnit.SECONDS);
} catch (InterruptedException e) { } catch (InterruptedException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
logInfo("RedisBungee shutdown complete");
} }
@Override @Override