Polish the admin command naming convention

This commit is contained in:
RongtongJin
2022-06-01 13:57:29 +08:00
parent e0121ca1da
commit 0efbb35920
4 changed files with 22 additions and 22 deletions
@@ -40,7 +40,7 @@ import org.apache.rocketmq.tools.command.broker.BrokerStatusSubCommand;
import org.apache.rocketmq.tools.command.broker.CleanExpiredCQSubCommand;
import org.apache.rocketmq.tools.command.broker.CleanUnusedTopicCommand;
import org.apache.rocketmq.tools.command.broker.GetBrokerConfigCommand;
import org.apache.rocketmq.tools.command.broker.GetBrokerEpochCacheCommand;
import org.apache.rocketmq.tools.command.broker.GetBrokerEpochCommand;
import org.apache.rocketmq.tools.command.broker.ResetMasterFlushOffsetSubCommand;
import org.apache.rocketmq.tools.command.broker.SendMsgStatusCommand;
import org.apache.rocketmq.tools.command.broker.UpdateBrokerConfigSubCommand;
@@ -249,7 +249,7 @@ public class MQAdminStartup {
initCommand(new HAStatusSubCommand());
initCommand(new SyncStateSetCommand());
initCommand(new GetBrokerEpochCacheCommand());
initCommand(new GetBrokerEpochCommand());
}
private static void initLogback() throws JoranException {
@@ -30,13 +30,13 @@ import org.apache.rocketmq.tools.command.CommandUtil;
import org.apache.rocketmq.tools.command.SubCommand;
import org.apache.rocketmq.tools.command.SubCommandException;
public class GetBrokerEpochCacheCommand implements SubCommand {
public class GetBrokerEpochCommand implements SubCommand {
@Override public String commandName() {
return "getBrokerEpochCache";
return "getBrokerEpoch";
}
@Override public String commandDesc() {
return "Fetch broker epoch entries cache";
return "Fetch broker epoch entries";
}
@Override public Options buildCommandlineOptions(Options options) {
@@ -48,7 +48,7 @@ public class GetBrokerEpochCacheCommand implements SubCommand {
opt.setRequired(false);
options.addOption(opt);
opt = new Option("f", "follow", true, "the interval(second) of get info");
opt = new Option("i", "interval", true, "the interval(second) of get info");
opt.setRequired(false);
options.addOption(opt);
@@ -61,11 +61,11 @@ public class GetBrokerEpochCacheCommand implements SubCommand {
defaultMQAdminExt.setInstanceName(Long.toString(System.currentTimeMillis()));
try {
if (commandLine.hasOption('f')) {
String flushSecondStr = commandLine.getOptionValue('f');
if (commandLine.hasOption('i')) {
String interval = commandLine.getOptionValue('i');
int flushSecond = 3;
if (flushSecondStr != null && !flushSecondStr.trim().equals("")) {
flushSecond = Integer.parseInt(flushSecondStr);
if (interval != null && !interval.trim().equals("")) {
flushSecond = Integer.parseInt(interval);
}
defaultMQAdminExt.start();
@@ -55,7 +55,7 @@ public class HAStatusSubCommand implements SubCommand {
opt.setRequired(false);
options.addOption(opt);
opt = new Option("f", "follow", true, "the interval(second) of get info");
opt = new Option("i", "interval", true, "the interval(second) of get info");
opt.setRequired(false);
options.addOption(opt);
@@ -68,11 +68,11 @@ public class HAStatusSubCommand implements SubCommand {
defaultMQAdminExt.setInstanceName(Long.toString(System.currentTimeMillis()));
try {
if (commandLine.hasOption('f')) {
String flushSecondStr = commandLine.getOptionValue('f');
if (commandLine.hasOption('i')) {
String interval = commandLine.getOptionValue('i');
int flushSecond = 3;
if (flushSecondStr != null && !flushSecondStr.trim().equals("")) {
flushSecond = Integer.parseInt(flushSecondStr);
if (interval != null && !interval.trim().equals("")) {
flushSecond = Integer.parseInt(interval);
}
defaultMQAdminExt.start();
@@ -56,7 +56,7 @@ public class SyncStateSetCommand implements SubCommand {
opt.setRequired(false);
options.addOption(opt);
opt = new Option("f", "follow", true, "the interval(second) of get info");
opt = new Option("i", "interval", true, "the interval(second) of get info");
opt.setRequired(false);
options.addOption(opt);
@@ -69,11 +69,11 @@ public class SyncStateSetCommand implements SubCommand {
defaultMQAdminExt.setInstanceName(Long.toString(System.currentTimeMillis()));
try {
if (commandLine.hasOption('f')) {
String flushSecondStr = commandLine.getOptionValue('f');
if (commandLine.hasOption('i')) {
String interval = commandLine.getOptionValue('i');
int flushSecond = 3;
if (flushSecondStr != null && !flushSecondStr.trim().equals("")) {
flushSecond = Integer.parseInt(flushSecondStr);
if (interval != null && !interval.trim().equals("")) {
flushSecond = Integer.parseInt(interval);
}
defaultMQAdminExt.start();
@@ -115,8 +115,8 @@ public class SyncStateSetCommand implements SubCommand {
DefaultMQAdminExt defaultMQAdminExt) throws Exception {
if (brokerNames.size() > 0) {
final InSyncStateData syncStateData = defaultMQAdminExt.getInSyncStateData(controllerAddress, brokerNames);
final Map<String, InSyncStateData.InSyncState> syncTable = syncStateData.getInSyncTable();
for (Map.Entry<String, InSyncStateData.InSyncState> next : syncTable.entrySet()) {
final Map<String, InSyncStateData.InSyncStateSet> syncTable = syncStateData.getInSyncStateTable();
for (Map.Entry<String, InSyncStateData.InSyncStateSet> next : syncTable.entrySet()) {
final List<InSyncStateData.InSyncMember> syncMembers = next.getValue().getInSyncMembers();
System.out.printf("\n#brokerName\t%s\n#MasterAddr\t%s\n#MasterEpoch\t%d\n#SyncStateSetEpoch\t%d\n#SyncStateSetMemberNums\t%d\n",
next.getKey(), next.getValue().getMasterAddress(), next.getValue().getMasterEpoch(), next.getValue().getSyncStateSetEpoch(),