pivotal-jbarrett commented on a change in pull request #7436: URL: https://github.com/apache/geode/pull/7436#discussion_r829562830
########## 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: The original code had `null` checks for something that could never be `null` since that would have caused `NullPointerException` elsewhere. By defining the values as `@NotNull` we can let the static analyzer enforce this too. -- 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