xvrl commented on code in PR #14827:
URL: https://github.com/apache/druid/pull/14827#discussion_r1309002399


##########
server/src/main/java/org/apache/druid/client/cache/MemcachedCache.java:
##########
@@ -355,9 +360,23 @@ public void updateHistogram(String name, int amount)
           .setReadBufferSize(config.getReadBufferSize())
           .setOpQueueFactory(opQueueFactory)
           .setMetricCollector(metricCollector)
-          .setEnableMetrics(MetricType.DEBUG) // Not as scary as it sounds
-          .build();
-
+          .setEnableMetrics(MetricType.DEBUG); // Not as scary as it sounds
+      if(config.enableTls()) {
+        // Build SSLContext
+        TrustManagerFactory tmf = 
TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
+        tmf.init((KeyStore) null);
+        SSLContext sslContext = SSLContext.getInstance("TLS");
+        sslContext.init(null, tmf.getTrustManagers(), null);
+        // Create the client in TLS mode
+        connectionFactoryBuilder.setSSLContext(sslContext);
+      }
+      if(Objects.equals(config.getClientMode(), "dynamic")) {
+        connectionFactoryBuilder.setClientMode(ClientMode.Dynamic);
+      }
+      else {
+        connectionFactoryBuilder.setClientMode(ClientMode.Static);

Review Comment:
   we should throw an error if someone provides an invalid client mode rather 
than defaulting to static



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to