This is an automated email from the ASF dual-hosted git repository.
jinrongtong pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/rocketmq.git
The following commit(s) were added to refs/heads/develop by this push:
new beee84fa44 [ISSUE #9868] Fix getBrokerEpoch no response issue for
empty parameters (#9869)
beee84fa44 is described below
commit beee84fa44a064b10ada99bc655fb707c1f772f2
Author: yx9o <[email protected]>
AuthorDate: Fri Dec 12 16:26:48 2025 +0800
[ISSUE #9868] Fix getBrokerEpoch no response issue for empty parameters
(#9869)
---
.../tools/command/broker/GetBrokerEpochSubCommand.java | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git
a/tools/src/main/java/org/apache/rocketmq/tools/command/broker/GetBrokerEpochSubCommand.java
b/tools/src/main/java/org/apache/rocketmq/tools/command/broker/GetBrokerEpochSubCommand.java
index 1a8961e046..324c4d5708 100644
---
a/tools/src/main/java/org/apache/rocketmq/tools/command/broker/GetBrokerEpochSubCommand.java
+++
b/tools/src/main/java/org/apache/rocketmq/tools/command/broker/GetBrokerEpochSubCommand.java
@@ -20,6 +20,7 @@ import java.util.List;
import java.util.Set;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.Option;
+import org.apache.commons.cli.OptionGroup;
import org.apache.commons.cli.Options;
import org.apache.rocketmq.remoting.RPCHook;
import org.apache.rocketmq.remoting.protocol.EpochEntry;
@@ -43,15 +44,13 @@ public class GetBrokerEpochSubCommand implements SubCommand
{
@Override
public Options buildCommandlineOptions(Options options) {
- Option opt = new Option("c", "clusterName", true, "which cluster");
- opt.setRequired(false);
- options.addOption(opt);
-
- opt = new Option("b", "brokerName", true, "which broker to fetch");
- opt.setRequired(false);
- options.addOption(opt);
+ OptionGroup group = new OptionGroup();
+ group.addOption(new Option("c", "clusterName", true, "which cluster"));
+ group.addOption(new Option("b", "brokerName", true, "which broker to
fetch"));
+ group.setRequired(true);
+ options.addOptionGroup(group);
- opt = new Option("i", "interval", true, "the interval(second) of get
info");
+ Option opt = new Option("i", "interval", true, "the interval(second)
of get info");
opt.setRequired(false);
options.addOption(opt);
@@ -68,7 +67,7 @@ public class GetBrokerEpochSubCommand implements SubCommand {
if (commandLine.hasOption('i')) {
String interval = commandLine.getOptionValue('i');
int flushSecond = 3;
- if (interval != null && !interval.trim().equals("")) {
+ if (interval != null && !interval.trim().isEmpty()) {
flushSecond = Integer.parseInt(interval);
}