Bill commented on a change in pull request #7436: URL: https://github.com/apache/geode/pull/7436#discussion_r829477485
########## File path: geode-core/src/main/java/org/apache/geode/cache/client/internal/LocatorList.java ########## @@ -0,0 +1,121 @@ +/* + * 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.cache.client.internal; + +import java.net.InetSocketAddress; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.Iterator; +import java.util.List; +import java.util.NoSuchElementException; +import java.util.concurrent.atomic.AtomicInteger; + +import org.apache.commons.lang3.StringUtils; +import org.jetbrains.annotations.NotNull; + +import org.apache.geode.annotations.Immutable; +import org.apache.geode.distributed.internal.tcpserver.HostAndPort; + +/** + * A list of locators, which remembers the last known good locator. + */ +class LocatorList implements Iterable<@NotNull HostAndPort> { Review comment: Interesting to see the `@NotNull` annotation in this context. Surprising! ########## File path: geode-core/src/test/java/org/apache/geode/cache/client/internal/AutoConnectionSourceImplTest.java ########## @@ -54,10 +52,9 @@ class AutoConnectionSourceImplTest { @Test - @Disabled("Effort under way to resolve flakiness.") void queryLocatorsTriesNextLocatorOnSSLExceptions() throws IOException, ClassNotFoundException { - final HostAndPort locator1 = mock(HostAndPort.class); - final HostAndPort locator2 = mock(HostAndPort.class); + final HostAndPort locator1 = new HostAndPort("locator1", 1234); + final HostAndPort locator2 = new HostAndPort("locator2", 1234); Review comment: yay objects (not mocks) ########## File path: geode-core/src/main/java/org/apache/geode/cache/client/internal/LocatorList.java ########## @@ -0,0 +1,121 @@ +/* + * 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.cache.client.internal; + +import java.net.InetSocketAddress; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.Iterator; +import java.util.List; +import java.util.NoSuchElementException; +import java.util.concurrent.atomic.AtomicInteger; + +import org.apache.commons.lang3.StringUtils; +import org.jetbrains.annotations.NotNull; + +import org.apache.geode.annotations.Immutable; +import org.apache.geode.distributed.internal.tcpserver.HostAndPort; + +/** + * A list of locators, which remembers the last known good locator. + */ +class LocatorList implements Iterable<@NotNull HostAndPort> { + /** + * A Comparator used to sort a list of locator addresses. This should not be used in other ways as + * it can return zero when two addresses aren't actually equal. + */ + @Immutable + static final Comparator<@NotNull HostAndPort> SOCKET_ADDRESS_COMPARATOR = + (address, otherAddress) -> { Review comment: My read is that this is method contains the only functional changes to product code in this PR. Do I have that right? My read is that the bug in the old code was that if one or the other address was null (but not both) then this method (incorrectly) returned `0`. -- 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...@geode.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org