Skip to content

Commit 3d3365c

Browse files
author
slfan1989
committed
YARN-11424. Fix CheckStyle.
1 parent a62e9e7 commit 3d3365c

File tree

4 files changed

+35
-21
lines changed
  • hadoop-yarn-project/hadoop-yarn
    • hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/conf
    • hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli
    • hadoop-yarn-server
      • hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/store/records
      • hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/amrmproxy

4 files changed

+35
-21
lines changed

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/conf/YarnConfiguration.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4302,7 +4302,8 @@ public static boolean isAclEnabled(Configuration conf) {
43024302
/** Subcluster timeout allowed by Router. **/
43034303
public static final String ROUTER_SUBCLUSTER_EXPIRATION_TIME =
43044304
ROUTER_PREFIX + "subcluster.heartbeat.expiration.time";
4305-
public static final long DEFAULT_ROUTER_SUBCLUSTER_EXPIRATION_TIME = 1800000;
4305+
public static final long DEFAULT_ROUTER_SUBCLUSTER_EXPIRATION_TIME =
4306+
TimeUnit.MINUTES.toMillis(30);;
43064307

43074308
////////////////////////////////
43084309
// CSI Volume configs

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/RouterCLI.java

Lines changed: 31 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,17 @@ private static void buildHelpMsg(String cmd, StringBuilder builder) {
7474

7575
if (usageInfo.args != null) {
7676
String space = (usageInfo.args == "") ? "" : " ";
77-
builder.append(" " + cmd + space + usageInfo.args + ": "
78-
+ usageInfo.help);
77+
builder.append(" ")
78+
.append(cmd)
79+
.append(space)
80+
.append(usageInfo.args)
81+
.append(": ")
82+
.append(usageInfo.help);
7983
} else {
80-
builder.append(" " + cmd + ": " + usageInfo.help);
84+
builder.append(" ")
85+
.append(cmd)
86+
.append(": ")
87+
.append(usageInfo.help);
8188
}
8289
}
8390

@@ -87,29 +94,35 @@ private static void buildIndividualUsageMsg(String cmd, StringBuilder builder) {
8794
return;
8895
}
8996
if (usageInfo.args == null) {
90-
builder.append("Usage: routeradmin [" + cmd + "]\n");
97+
builder.append("Usage: routeradmin [")
98+
.append(cmd)
99+
.append("]\n");
91100
} else {
92101
String space = (usageInfo.args == "") ? "" : " ";
93-
builder.append("Usage: routeradmin [" + cmd + space + usageInfo.args + "]\n");
102+
builder.append("Usage: routeradmin [")
103+
.append(cmd)
104+
.append(space)
105+
.append(usageInfo.args)
106+
.append("]\n");
94107
}
95108
}
96109

97110
private static void printHelp() {
98111
StringBuilder summary = new StringBuilder();
99-
summary.append("router-admin is the command to execute " +
100-
"YARN Federation administrative commands.\n");
101-
summary.append("The full syntax is: \n\n"
102-
+ "routeradmin"
103-
+ " [-deregisterSubCluster [-c|clusterId [subClusterId]]");
112+
summary.append("router-admin is the command to execute ")
113+
.append("YARN Federation administrative commands.\n");
114+
summary.append("The full syntax is: \n\n")
115+
.append("routeradmin")
116+
.append(" [-deregisterSubCluster [-c|clusterId [subClusterId]]");
104117
summary.append(" [-help [cmd]]").append("\n");
105118
StringBuilder helpBuilder = new StringBuilder();
106119
System.out.println(summary);
107120
for (String cmdKey : ADMIN_USAGE.keySet()) {
108121
buildHelpMsg(cmdKey, helpBuilder);
109122
helpBuilder.append("\n");
110123
}
111-
helpBuilder.append(" -help [cmd]: Displays help for the given command or all commands" +
112-
" if none is specified.");
124+
helpBuilder.append(" -help [cmd]: Displays help for the given command or all commands")
125+
.append(" if none is specified.");
113126
System.out.println(helpBuilder);
114127
System.out.println();
115128
ToolRunner.printGenericCommandUsage(System.out);
@@ -127,9 +140,13 @@ private static void buildUsageMsg(StringBuilder builder) {
127140
builder.append("Usage: router-admin\n");
128141
for (Map.Entry<String, UsageInfo> cmdEntry : ADMIN_USAGE.entrySet()) {
129142
UsageInfo usageInfo = cmdEntry.getValue();
130-
builder.append(" " + cmdEntry.getKey() + " " + usageInfo.args + "\n");
143+
builder.append(" ")
144+
.append(cmdEntry.getKey())
145+
.append(" ")
146+
.append(usageInfo.args)
147+
.append("\n");
131148
}
132-
builder.append(" -help" + " [cmd]\n");
149+
builder.append(" -help [cmd]\n");
133150
}
134151

135152
private static void printUsage(String cmd) {

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/store/records/SubClusterState.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,8 @@ public enum SubClusterState {
5151
/** Subcluster has unregistered. */
5252
SC_UNREGISTERED;
5353

54-
public boolean isUnusable() {
55-
return (this != SC_RUNNING && this != SC_NEW);
56-
}
57-
5854
public boolean isUsable() {
59-
return !isUnusable();
55+
return (this == SC_RUNNING || this == SC_NEW);
6056
}
6157

6258
public boolean isActive() {

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/amrmproxy/FederationInterceptor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1877,7 +1877,7 @@ private boolean isSCHealth(SubClusterId subClusterId) throws YarnException {
18771877
Set<SubClusterId> timeOutScs = getTimedOutSCs(true);
18781878
SubClusterInfo subClusterInfo = federationFacade.getSubCluster(subClusterId);
18791879
if (timeOutScs.contains(subClusterId) ||
1880-
subClusterInfo == null || subClusterInfo.getState().isUnusable()) {
1880+
subClusterInfo == null || !subClusterInfo.getState().isUsable()) {
18811881
return false;
18821882
}
18831883
return true;

0 commit comments

Comments
 (0)