dlmarion commented on code in PR #3482:
URL: https://github.com/apache/accumulo/pull/3482#discussion_r1227229832
##########
core/src/main/java/org/apache/accumulo/core/metadata/TServerInstance.java:
##########
@@ -34,56 +36,74 @@
*/
public class TServerInstance implements Comparable<TServerInstance> {
+ private static final String FORMAT = "%s#%s#%s";
+
private final HostAndPort hostAndPort;
private final String hostPort;
private final String session;
- private final String hostPortSession;
+ private final String hostPortSessionGroup;
+ private final String group;
+
+ public static TServerInstance fromString(String val) {
+ Objects.requireNonNull(val, "String value for TServerInstance cannot be
null");
+ String[] parts = val.split("#");
+ if (parts.length != 3) {
+ // could throw IllegalArgumentException, but IllegalStateException is
something
+ // that is already expected in a large portion of the codebase.
+ throw new IllegalStateException(
+ "Supplied TServerInstance string: " + val + " does not follow
format: " + FORMAT);
+ }
+ return new TServerInstance(parts[0], parts[1], parts[2]);
+ }
- public TServerInstance(HostAndPort address, String session) {
+ public TServerInstance(HostAndPort address, String session, String group) {
this.hostAndPort = address;
this.session = session;
this.hostPort = hostAndPort.toString();
- this.hostPortSession = hostPort + "[" + session + "]";
+ this.group = group;
Review Comment:
No, the default value is ServiceDescriptor..DEFAULT_GROUP_NAME.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]