geode-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kohlmu-pivotal <...@git.apache.org>
Subject [GitHub] geode pull request #716: GEODE-3406: Locator accepts Protobuf requests
Date Thu, 17 Aug 2017 17:44:56 GMT
Github user kohlmu-pivotal commented on a diff in the pull request:

    https://github.com/apache/geode/pull/716#discussion_r133780406
  
    --- Diff: geode-protobuf/src/main/java/org/apache/geode/protocol/protobuf/operations/GetAvailableServersOperationHandler.java
---
    @@ -50,51 +37,19 @@
       @Override
       public Result<ServerAPI.GetAvailableServersResponse> process(
           SerializationService serializationService, ServerAPI.GetAvailableServersRequest
request,
    -      Cache cache) {
    -
    -    InternalDistributedSystem distributedSystem =
    -        (InternalDistributedSystem) cache.getDistributedSystem();
    -    Properties properties = distributedSystem.getProperties();
    -    String locatorsString = properties.getProperty(ConfigurationProperties.LOCATORS);
    -
    -    HashSet<DistributionLocatorId> locators = new HashSet();
    -    StringTokenizer stringTokenizer = new StringTokenizer(locatorsString, ",");
    -    while (stringTokenizer.hasMoreTokens()) {
    -      String locator = stringTokenizer.nextToken();
    -      if (StringUtils.isNotEmpty(locator)) {
    -        locators.add(new DistributionLocatorId(locator));
    -      }
    -    }
    +      ExecutionContext executionContext) throws InvalidExecutionContextException {
     
    -    TcpClient tcpClient = getTcpClient();
    -    for (DistributionLocatorId locator : locators) {
    -      try {
    -        return getGetAvailableServersFromLocator(tcpClient, locator.getHost());
    -      } catch (IOException | ClassNotFoundException e) {
    -        // try the next locator
    -      }
    -    }
    -    return Failure.of(ProtobufResponseUtilities.makeErrorResponse(
    -        ProtocolErrorCode.DATA_UNREACHABLE.codeValue, "Unable to find a locator"));
    -  }
    +    InternalLocator locator = executionContext.getLocator();
    +    ArrayList servers2 = locator.getServerLocatorAdvisee().getLoadSnapshot().getServers(null);
    --- End diff --
    
    why 'servers2'? What does the numeric denote? Maybe a different descriptive variable name
is required... like 'availableServers'


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message