kamilla1201 commented on a change in pull request #6308: URL: https://github.com/apache/geode/pull/6308#discussion_r617113620
########## File path: geode-membership/src/main/java/org/apache/geode/distributed/internal/membership/api/HostAddress.java ########## @@ -0,0 +1,106 @@ +/* + * 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 + * + * http://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.geode.distributed.internal.membership.api; + +import java.net.InetAddress; +import java.net.InetSocketAddress; +import java.util.Objects; + +import org.apache.commons.validator.routines.InetAddressValidator; + +import org.apache.geode.distributed.internal.tcpserver.HostAndPort; + +/** + * HostAddress is a holder of a host name/address. It is the primary + * way to specify a host address that may or may not have been resolved to an InetAddress. + * + * @See HostAddress which can hold both a hast name and a port Review comment: Typo in "host" here ########## File path: geode-assembly/src/acceptanceTest/java/org/apache/geode/client/sni/DualServerSNIAcceptanceTest.java ########## @@ -97,6 +107,17 @@ public void after() { ensureCacheClosed(); } + @AfterClass + public static void afterClass() throws Exception { + // try { + // String output = + // docker.get().exec(options("-T"), "locator-maeve", Review comment: Maybe it's worth adding a comment explaining why this commented code is useful and should not be removed ########## File path: geode-core/src/main/java/org/apache/geode/distributed/Locator.java ########## @@ -101,7 +105,7 @@ */ public static Locator startLocator(int port, File logFile) throws IOException { - return startLocator(port, logFile, false, (InetAddress) null, (Properties) null, true, true, + return startLocator(port, logFile, false, (HostAddress) null, (Properties) null, true, true, Review comment: Here and in a few other places in this file (that call startLocator) casting null args to HostAddress or Properties seems redundant. Is there a reason to keep that anyway? ########## File path: geode-core/src/main/java/org/apache/geode/internal/DistributionLocator.java ########## @@ -136,28 +139,27 @@ public static void main(String args[]) { } if (!Boolean.getBoolean(InternalDistributedSystem.DISABLE_SHUTDOWN_HOOK_PROPERTY)) { - final InetAddress faddress = address; + final HostAddress faddress = hostAddress; Runtime.getRuntime() .addShutdownHook(new LoggingThread("LocatorShutdownThread", false, () -> { try { - DistributionLocator.shutdown(port, faddress); + DistributionLocator.shutdown(port, faddress.getAddress()); } catch (IOException e) { e.printStackTrace(); } })); } - lockFile = ManagerInfo.setLocatorStarting(directory, port, address); + lockFile = ManagerInfo.setLocatorStarting(directory, port, + hostAddress == null ? null : hostAddress.getAddress()); Review comment: Looks like this could be simplified by creating the `address` variable a bit earlier ``` final InetAddress address = hostAddress == null ? null : hostAddress.getAddress(); lockFile = ManagerInfo.setLocatorStarting(directory, port, address); ``` -- 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. For queries about this service, please contact Infrastructure at: [email protected]
