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:
[email protected]