HBASE-24620 : Replace String.join with StringBuilder for JDK 7 compatibility

This commit is contained in:
Viraj Jasani 2020-12-22 11:16:35 +05:30
parent e9c45a1353
commit 73d079eb67
No known key found for this signature in database
GPG Key ID: B3D6C0B41C8ADFD5
1 changed files with 6 additions and 1 deletions

View File

@ -40,10 +40,15 @@ public class ChaosUtils {
String port =
Integer.toString(conf.getInt(HConstants.ZOOKEEPER_CLIENT_PORT, 2181));
String[] serverHosts = conf.getStrings(HConstants.ZOOKEEPER_QUORUM, "localhost");
StringBuilder sb = new StringBuilder();
for (int i = 0; i < serverHosts.length; i++) {
serverHosts[i] = serverHosts[i] + ":" + port;
sb.append(serverHosts[i]);
if (i < serverHosts.length - 1) {
sb.append(",");
}
}
return String.join(",", serverHosts);
return sb.toString();
}
}