heesung-sn commented on code in PR #21789:
URL: https://github.com/apache/pulsar/pull/21789#discussion_r1434688017
##########
pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConnectionHandler.java:
##########
@@ -94,10 +96,13 @@ protected void grabCnx(Optional<URI> hostURI) {
try {
CompletableFuture<ClientCnx> cnxFuture;
if (hostURI.isPresent()) {
- InetSocketAddress address = InetSocketAddress.createUnresolved(
- hostURI.get().getHost(),
- hostURI.get().getPort());
- cnxFuture = state.client.getConnection(address, address,
randomKeyForSelectConnection);
+ URI uri = hostURI.get();
+ InetSocketAddress address =
InetSocketAddress.createUnresolved(uri.getHost(), uri.getPort());
+ if (useProxy) {
+ cnxFuture = state.client.getProxiedConnection(address,
randomKeyForSelectConnection);
+ } else {
+ cnxFuture = state.client.getConnection(address, address,
randomKeyForSelectConnection);
Review Comment:
Sorry. I think `volatile Boolean useProxy` is better to consider thread
safety.
--
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]