dlmarion commented on code in PR #3189: URL: https://github.com/apache/accumulo/pull/3189#discussion_r1099147644
########## core/src/main/java/org/apache/accumulo/core/util/ServiceLockData.java: ########## @@ -0,0 +1,223 @@ +/* + * 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.util; + +import java.util.Collections; +import java.util.EnumMap; +import java.util.HashSet; +import java.util.Optional; +import java.util.Set; +import java.util.UUID; + +import com.google.common.net.HostAndPort; +import com.google.gson.Gson; + +public class ServiceLockData implements Comparable<ServiceLockData> { + + private static final Gson gson = new Gson(); + + /** + * Thrift Service list + */ + public static enum ThriftService { + CLIENT, + COORDINATOR, + COMPACTOR, + FATE, + GC, + MANAGER, + NONE, + TABLET_INGEST, + TABLET_MANAGEMENT, + TABLET_SCAN, + TSERV + } + + /** + * An object that describes a process, the group assigned to that process, the Thrift service and + * the address to use to communicate with that service. + */ + public static class ServiceDescriptor { + + /** + * The group name that will be used when one is not specified. + */ + public static final String DEFAULT_GROUP_NAME = "default"; + + private final UUID uuid; + private final ThriftService service; + private final String address; + private final String group; + + public ServiceDescriptor(UUID uuid, ThriftService service, String address, String group) { + super(); + this.uuid = uuid; + this.service = service; + this.address = address; + this.group = Optional.ofNullable(group).orElse(DEFAULT_GROUP_NAME); + } + + public UUID getUUID() { + return uuid; + } + + public ThriftService getService() { + return service; + } + + public String getAddress() { + return address; + } + + public String getGroup() { + return group; + } + + @Override + public int hashCode() { + return toString().hashCode(); + } + + @Override + public boolean equals(Object o) { + if (o instanceof ServiceDescriptor) { Review Comment: This came over as part of the rename from ServerServices to ServiceLockData. -- 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]
