You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@geode.apache.org by "Bruce J Schuchardt (Jira)" <ji...@apache.org> on 2021/02/19 16:41:00 UTC

[jira] [Created] (GEODE-8955) WAN location service uses DistributedLocatorId.toString() to represent a locator

Bruce J Schuchardt created GEODE-8955:
-----------------------------------------

             Summary: WAN location service uses DistributedLocatorId.toString() to represent a locator
                 Key: GEODE-8955
                 URL: https://issues.apache.org/jira/browse/GEODE-8955
             Project: Geode
          Issue Type: Improvement
          Components: wan
            Reporter: Bruce J Schuchardt


This code in LocatorHelper, and probably code in other parts of the WAN location service, uses DistributionLocatorId.toString() to track whether other locators have the WAN location service available.  It should use the DistributionLocatorId.marshal() method instead.  We should never use the toString() representation of an object in this way as it may change over time.

 
{code:java}
private static void addServerLocator(Integer distributedSystemId,
    LocatorMembershipListener locatorListener, DistributionLocatorId locator) {
  ConcurrentHashMap<Integer, Set<String>> allServerLocatorsInfo =
      (ConcurrentHashMap<Integer, Set<String>>) locatorListener.getAllServerLocatorsInfo();

  Set<String> locatorsSet = new CopyOnWriteHashSet<String>();
  locatorsSet.add(locator.toString());
  Set<String> existingValue = allServerLocatorsInfo.putIfAbsent(distributedSystemId, locatorsSet);
  if (existingValue != null) {
    if (!existingValue.contains(locator.toString())) {
      existingValue.add(locator.toString());
    }
  }
}
{code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)