[ 
https://issues.apache.org/jira/browse/GEODE-8872?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17271658#comment-17271658
 ] 

ASF GitHub Bot commented on GEODE-8872:
---------------------------------------

DonalEvans commented on a change in pull request #5948:
URL: https://github.com/apache/geode/pull/5948#discussion_r564014872



##########
File path: 
geode-core/src/main/java/org/apache/geode/distributed/internal/ServerLocator.java
##########
@@ -378,24 +379,40 @@ public void endResponse(Object request, long startTime) {
   }
 
 
-
-  private List<ServerLocation> getLocators() {
-    if (cachedLocators != null) {
+  private List<ServerLocation> getLocators(boolean requestInternal) {
+    if (cachedLocators != null && cachedRequestInternalLocators == 
requestInternal) {
       return cachedLocators;
     } else {
       synchronized (cachedLocatorsLock) {
         List<ControllerProfile> profiles = advisor.fetchControllers();
         List<ServerLocation> result = new ArrayList<>(profiles.size() + 1);
         for (ControllerProfile profile : profiles) {
-          result.add(buildServerLocation(profile));
+          result.add(buildServerLocation(profile, requestInternal));
         }
-        result.add(new ServerLocation(hostNameForClients, port));
+        String host;
+        if (requestInternal) {
+          host = hostName;
+        } else {
+          host = hostNameForClients;
+        }
+        result.add(new ServerLocation(host, port));
+        cachedRequestInternalLocators = requestInternal;
         cachedLocators = result;
         return result;
       }
     }
   }
 
+  protected static ServerLocation buildServerLocation(GridProfile p, boolean 
requestInternal) {
+    String host;
+    if (requestInternal) {
+      host = p.getInternalHost();
+    } else {
+      host = p.getHost();
+    }
+    return new ServerLocation(host, p.getPort());
+  }
+
   protected static ServerLocation buildServerLocation(GridProfile p) {

Review comment:
       Could uses of this method be replaced with calls to the new, 
two-argument method instead, to reduce redundancy?

##########
File path: 
geode-core/src/main/java/org/apache/geode/cache/client/internal/PoolImpl.java
##########
@@ -767,6 +778,10 @@ public void sameAs(Object obj) {
       throw new RuntimeException(
           String.format("Pool %s are different", "servers"));
     }
+    if (getRequestLocatorInternalAddress() != 
other.getRequestLocatorInternalAddress()) {
+      throw new RuntimeException(
+          String.format("Pool %s is different", 
"requestLocatorInternalAddress"));

Review comment:
       This doesn't need to be a `String.format()` call, it could just be 
`"Pool requestLocatorInternalAddress is different"`.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Add client option, to request locators internal host addresses 
> ---------------------------------------------------------------
>
>                 Key: GEODE-8872
>                 URL: https://issues.apache.org/jira/browse/GEODE-8872
>             Project: Geode
>          Issue Type: New Feature
>          Components: client/server
>            Reporter: Mario Ivanac
>            Assignee: Mario Ivanac
>            Priority: Major
>              Labels: pull-request-available
>
> Additional option for clients, when pool is created, to request locators 
> internal host addresses.
> When sending LocatorListRequest in some cases we need to get internal host 
> addresses.



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

Reply via email to