gaohoward commented on code in PR #4385: URL: https://github.com/apache/activemq-artemis/pull/4385#discussion_r1121564380
########## artemis-commons/src/main/java/org/apache/activemq/artemis/utils/NetworkUtil.java: ########## @@ -0,0 +1,84 @@ +/** + * 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 + * <p> + * http://www.apache.org/licenses/LICENSE-2.0 + * <p> + * 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.activemq.artemis.utils; + +import java.net.InetAddress; +import java.net.UnknownHostException; + +/** + * This is a wrapper class of some InetAddress methods + * so we can mock them with static values in test environment + */ +public class NetworkUtil { + + public static final InetAddressWrapper[] EMPTY_ADDRESSES = {}; + public static TestMode testMode = null; Review Comment: > I havent looked at the code yet, but have a more general wonder about this change. > > Not all that long ago we effectively made an opposite kind of change in the failover bits of qpid-jms to resolve an issue where its use of resolved IPs for hostnames actually broke things. We made it stop resolving failover hosts to their IPs for comparison and just use the hostname string values as given, because resolving them like it previously did meant it would often be de-duping away entirely distinct hostname values that all just happened to resolve to the same IP, which is a lot more common these days than when the original code was written, due to use of TLS SNI in general and specifically in cloud environments (e.g connections hitting some form of gateway that uses SNI to determine which 'host' is actually being connected to). It probably is not that complex for this use case. By the time this kind of comparison is called the hostnames have been compared already. I'm not sure if broker can be setup to distinguish 2 hostnames as different hosts even if they are of same ip? I mean can 2 broker in a cluster binding to same ip and same port? -- 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]
