2
0
mirror of https://github.com/proxiodev/RedisBungee.git synced 2024-11-22 20:28:00 +00:00

Introduce /rdebug command to expose some pool statistics.

This commit is contained in:
Tux 2015-08-02 19:57:48 -04:00
parent 431ff013e1
commit 121040ad90
2 changed files with 21 additions and 1 deletions

View File

@ -308,6 +308,7 @@ public final class RedisBungee extends Plugin {
getProxy().getPluginManager().registerCommand(this, new RedisBungeeCommands.ServerIds()); getProxy().getPluginManager().registerCommand(this, new RedisBungeeCommands.ServerIds());
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));
getProxy().getPluginManager().registerCommand(this, new RedisBungeeCommands.DebugCommand(this));
api = new RedisBungeeAPI(this); api = new RedisBungeeAPI(this);
getProxy().getPluginManager().registerListener(this, new RedisBungeeListener(this, configuration.getExemptAddresses())); getProxy().getPluginManager().registerListener(this, new RedisBungeeListener(this, configuration.getExemptAddresses()));
getProxy().getPluginManager().registerListener(this, dataManager); getProxy().getPluginManager().registerListener(this, dataManager);

View File

@ -314,7 +314,7 @@ class RedisBungeeCommands {
private final RedisBungee plugin; private final RedisBungee plugin;
PlistCommand(RedisBungee plugin) { PlistCommand(RedisBungee plugin) {
super("plist", "redisbungee.command.plist", "redisbungee", "rplist"); super("plist", "redisbungee.command.plist", "rplist");
this.plugin = plugin; this.plugin = plugin;
} }
@ -360,4 +360,23 @@ class RedisBungeeCommands {
}); });
} }
} }
public static class DebugCommand extends Command {
private final RedisBungee plugin;
DebugCommand(RedisBungee plugin) {
super("rdebug", "redisbungee.command.debug");
this.plugin = plugin;
}
@Override
public void execute(final CommandSender sender, final String[] args) {
TextComponent poolActiveStat = new TextComponent("Currently active pool objects: " + plugin.getPool().getNumActive());
TextComponent poolIdleStat = new TextComponent("Currently idle pool objects: " + plugin.getPool().getNumIdle());
TextComponent poolWaitingStat = new TextComponent("Waiting on free objects: " + plugin.getPool().getNumWaiters());
sender.sendMessage(poolActiveStat);
sender.sendMessage(poolIdleStat);
sender.sendMessage(poolWaitingStat);
}
}
} }