You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by mm...@apache.org on 2019/05/31 16:14:18 UTC
[pulsar] branch master updated: Use a static instance of hostname
verifier in ClientCnx (#4415)
This is an automated email from the ASF dual-hosted git repository.
mmerli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git
The following commit(s) were added to refs/heads/master by this push:
new 38503b2 Use a static instance of hostname verifier in ClientCnx (#4415)
38503b2 is described below
commit 38503b2d32444c7065f4b78018ec08cf59dd4157
Author: Matteo Merli <mm...@apache.org>
AuthorDate: Fri May 31 09:14:13 2019 -0700
Use a static instance of hostname verifier in ClientCnx (#4415)
---
.../src/main/java/org/apache/pulsar/client/impl/ClientCnx.java | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ClientCnx.java b/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ClientCnx.java
index d53b3d7..09dbcc9 100644
--- a/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ClientCnx.java
+++ b/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ClientCnx.java
@@ -132,7 +132,8 @@ public class ClientCnx extends PulsarHandler {
// Remote hostName with which client is connected
protected String remoteHostName = null;
private boolean isTlsHostnameVerificationEnable;
- private DefaultHostnameVerifier hostnameVerifier;
+
+ private static final DefaultHostnameVerifier HOSTNAME_VERIFIER = new DefaultHostnameVerifier();
private ScheduledFuture<?> timeoutTask;
@@ -170,7 +171,6 @@ public class ClientCnx extends PulsarHandler {
this.operationTimeoutMs = conf.getOperationTimeoutMs();
this.state = State.None;
this.isTlsHostnameVerificationEnable = conf.isTlsHostnameVerificationEnable();
- this.hostnameVerifier = new DefaultHostnameVerifier();
this.protocolVersion = protocolVersion;
}
@@ -847,7 +847,7 @@ public class ClientCnx extends PulsarHandler {
log.debug("Verifying HostName for {}, Cipher {}, Protocols {}", hostname, sslSession.getCipherSuite(),
sslSession.getProtocol());
}
- return hostnameVerifier.verify(hostname, sslSession);
+ return HOSTNAME_VERIFIER.verify(hostname, sslSession);
}
return false;
}