AnonHxy commented on code in PR #21232:
URL: https://github.com/apache/pulsar/pull/21232#discussion_r1333928866
##########
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<>();
Review Comment:
I think that `MutableObject` is useful when the type of param is primitive,
and we want change the it' value in the method.
So maybe a simple `CompletableFuture` is enough here, e.g.:
```
CompletableFuture<Pair<InetSocketAddress, InetSocketAddress>> localFuture =
null;
```
All the `newFutureCreated.getValue()` could be replaced by `localFuture`.
It will helpful for jvm minor GC.
--
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]