dlmarion commented on code in PR #3626: URL: https://github.com/apache/accumulo/pull/3626#discussion_r1268332376
########## core/src/main/java/org/apache/accumulo/core/client/admin/servers/Server.java: ########## @@ -0,0 +1,110 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.accumulo.core.client.admin.servers; + +import java.util.Comparator; +import java.util.Objects; + +import com.google.common.base.Preconditions; + +public abstract class Server implements Comparator<Server>, Comparable<Server> { + + private final ServerType type; + private final String host; + private final int port; + + protected Server(ServerType type, String host, int port) { + super(); + Preconditions.checkArgument(port > 0); + this.type = Objects.requireNonNull(type); + this.host = Objects.requireNonNull(host); + this.port = port; + } + + public ServerType getType() { + return type; + } + + public String getHost() { + return host; + } + + public int getPort() { + return port; + } + + @Override + public int compare(Server first, Server second) { + if (first == second) { + return 0; + } + if (first != null && second == null) { Review Comment: I removed these checks and implemented something different in ea67851. If first or second is null, then I throw an NPE, which is documented in [Comparator](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Comparator.html#compare(T,T)) -- 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: notifications-unsubscr...@accumulo.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org