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:
parent
431ff013e1
commit
121040ad90
@ -308,6 +308,7 @@ public final class RedisBungee extends Plugin {
|
||||
getProxy().getPluginManager().registerCommand(this, new RedisBungeeCommands.ServerIds());
|
||||
getProxy().getPluginManager().registerCommand(this, new RedisBungeeCommands.PlayerProxyCommand(this));
|
||||
getProxy().getPluginManager().registerCommand(this, new RedisBungeeCommands.PlistCommand(this));
|
||||
getProxy().getPluginManager().registerCommand(this, new RedisBungeeCommands.DebugCommand(this));
|
||||
api = new RedisBungeeAPI(this);
|
||||
getProxy().getPluginManager().registerListener(this, new RedisBungeeListener(this, configuration.getExemptAddresses()));
|
||||
getProxy().getPluginManager().registerListener(this, dataManager);
|
||||
|
@ -314,7 +314,7 @@ class RedisBungeeCommands {
|
||||
private final RedisBungee plugin;
|
||||
|
||||
PlistCommand(RedisBungee plugin) {
|
||||
super("plist", "redisbungee.command.plist", "redisbungee", "rplist");
|
||||
super("plist", "redisbungee.command.plist", "rplist");
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user