heesung-sn commented on code in PR #21232:
URL: https://github.com/apache/pulsar/pull/21232#discussion_r1333433546
##########
pulsar-client/src/main/java/org/apache/pulsar/client/impl/BinaryProtoLookupService.java:
##########
@@ -92,15 +100,43 @@ public void updateServiceUrl(String serviceUrl) throws
PulsarClientException {
* @return broker-socket-address that serves given topic
*/
public CompletableFuture<Pair<InetSocketAddress, InetSocketAddress>>
getBroker(TopicName topicName) {
- return findBroker(serviceNameResolver.resolveHost(), false, topicName,
0);
+ final MutableObject<CompletableFuture> newFutureCreated = new
MutableObject<>();
+ try {
+ return lookupInProgress.computeIfAbsent(topicName, tpName -> {
+ CompletableFuture<Pair<InetSocketAddress, InetSocketAddress>>
newFuture =
+ findBroker(serviceNameResolver.resolveHost(), false,
topicName, 0);
+ newFutureCreated.setValue(newFuture);
Review Comment:
Can we remove `newFutureCreated` by the following?
```
lookupInProgress.computeIfAbsent(topicName, tpName -> {
..
newFuture.whenComplete((x, e) -> {
lookupInProgress.remove(topicName);
});
return newFuture;
});
```
--
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]