This is an automated email from the ASF dual-hosted git repository.

burcham pushed a commit to branch sni
in repository https://gitbox.apache.org/repos/asf/geode-benchmarks.git


The following commit(s) were added to refs/heads/sni by this push:
     new 25b3972  StartClientSNI connects to locator via off platform name
25b3972 is described below

commit 25b39728378c52a8706f207ea1d519ef1f4695b3
Author: Bill Burcham <bburc...@pivotal.io>
AuthorDate: Fri May 22 15:56:08 2020 -0700

    StartClientSNI connects to locator via off platform name
---
 .../org/apache/geode/benchmark/tasks/StartClient.java |  9 ++++-----
 .../apache/geode/benchmark/tasks/StartClientSNI.java  | 19 ++++++++++++++-----
 .../apache/geode/benchmark/tasks/StartLocatorSNI.java |  3 ++-
 .../apache/geode/benchmark/tasks/StartServerSNI.java  |  3 ++-
 4 files changed, 22 insertions(+), 12 deletions(-)

diff --git 
a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tasks/StartClient.java
 
b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tasks/StartClient.java
index c05f405..6e6d9bf 100644
--- 
a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tasks/StartClient.java
+++ 
b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tasks/StartClient.java
@@ -36,7 +36,7 @@ import org.apache.geode.perftest.TestContext;
  * Task to create the client cache
  */
 public class StartClient implements Task {
-  private int locatorPort;
+  protected int locatorPort;
 
   public StartClient(int locatorPort) {
     this.locatorPort = locatorPort;
@@ -59,8 +59,7 @@ public class StartClient implements Task {
   /**
    * Create and configure the ClientCacheFactory.
    *
-   * Subclasses can override this. They return the result from calling super 
(or calling
-   * builder methods on the result from calling super)
+   * Subclasses can override this.
    *
    * @param locator
    * @param statsFile
@@ -75,8 +74,8 @@ public class StartClient implements Task {
       throws UnknownHostException {
     return new ClientCacheFactory(properties)
         .setPdxSerializer(new 
ReflectionBasedAutoSerializer("benchmark.geode.data.*"))
-        .addPoolLocator(locator.getHostAddress(), locatorPort)
         .setPoolIdleTimeout(-1)
-        .set(ConfigurationProperties.STATISTIC_ARCHIVE_FILE, statsFile);
+        .set(ConfigurationProperties.STATISTIC_ARCHIVE_FILE, statsFile)
+        .addPoolLocator(locator.getHostAddress(), locatorPort);
   }
 }
diff --git 
a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tasks/StartClientSNI.java
 
b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tasks/StartClientSNI.java
index d546d36..472cde8 100644
--- 
a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tasks/StartClientSNI.java
+++ 
b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tasks/StartClientSNI.java
@@ -1,6 +1,7 @@
 package org.apache.geode.benchmark.tasks;
 
 import static 
org.apache.geode.benchmark.tasks.DefineHostNamingsOffPlatformTask.getOffPlatformHostName;
+import static org.apache.geode.benchmark.topology.Roles.LOCATOR;
 import static org.apache.geode.benchmark.topology.Roles.PROXY;
 
 import java.net.InetAddress;
@@ -9,6 +10,8 @@ import java.util.Properties;
 
 import org.apache.geode.cache.client.ClientCacheFactory;
 import org.apache.geode.cache.client.proxy.ProxySocketFactories;
+import org.apache.geode.distributed.ConfigurationProperties;
+import org.apache.geode.pdx.ReflectionBasedAutoSerializer;
 import org.apache.geode.perftest.TestContext;
 
 public class StartClientSNI extends StartClient {
@@ -25,14 +28,20 @@ public class StartClientSNI extends StartClient {
                                                         final TestContext 
context)
       throws UnknownHostException {
 
-    final InetAddress firstProxyAddy =
+    final InetAddress firstLocatorAddy =
+        context.getHostsForRole(LOCATOR.name()).iterator().next();
+    final String offPlatformLocatorName =
+        getOffPlatformHostName(context, firstLocatorAddy);
+    final InetAddress proxyAddy =
         context.getHostsForRole(PROXY.name()).iterator().next();
-    final String
-        offPlatformHostName = getOffPlatformHostName(context, firstProxyAddy);
 
-    return super.createClientCacheFactory(locator, statsFile, properties, 
context)
+    return new ClientCacheFactory(properties)
+        .setPdxSerializer(new 
ReflectionBasedAutoSerializer("benchmark.geode.data.*"))
+        .setPoolIdleTimeout(-1)
+        .set(ConfigurationProperties.STATISTIC_ARCHIVE_FILE, statsFile)
+        .addPoolLocator(offPlatformLocatorName, locatorPort)
         .setPoolSocketFactory(ProxySocketFactories.sni(
-            offPlatformHostName,
+            proxyAddy.getHostAddress(),
             SNI_PROXY_PORT));
   }
 
diff --git 
a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tasks/StartLocatorSNI.java
 
b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tasks/StartLocatorSNI.java
index b1b9e01..bc2a043 100644
--- 
a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tasks/StartLocatorSNI.java
+++ 
b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tasks/StartLocatorSNI.java
@@ -21,7 +21,8 @@ public class StartLocatorSNI extends StartLocator {
     new LocatorLauncher.Builder()
         .set(properties)
         .setPort(locatorPort)
-        .setHostnameForClients(getOffPlatformHostName(context, 
InetAddress.getLocalHost()))
+        .setHostnameForClients(
+            getOffPlatformHostName(context, InetAddress.getLocalHost()))
         .build()
         .start();
   }
diff --git 
a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tasks/StartServerSNI.java
 
b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tasks/StartServerSNI.java
index 677f451..1ce09b4 100644
--- 
a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tasks/StartServerSNI.java
+++ 
b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tasks/StartServerSNI.java
@@ -18,7 +18,8 @@ public class StartServerSNI extends StartServer {
   protected void configureCacheServer(final CacheServer cacheServer, final 
TestContext context)
       throws UnknownHostException {
     super.configureCacheServer(cacheServer, context);
-    cacheServer.setHostnameForClients(getOffPlatformHostName(context, 
InetAddress.getLocalHost()));
+    cacheServer.setHostnameForClients(
+        getOffPlatformHostName(context, InetAddress.getLocalHost()));
   }
 
 }

Reply via email to