poorbarcode commented on code in PR #16540:
URL: https://github.com/apache/pulsar/pull/16540#discussion_r941980683
##########
pulsar-broker/src/test/java/org/apache/pulsar/broker/service/BrokerServiceTest.java:
##########
@@ -1056,7 +1105,12 @@ public void testLookupThrottlingForClientByClient()
throws Exception {
long reqId10 = reqId++;
ByteBuf request10 = Commands.newLookup(topicName, true, reqId10);
f3 = pool.getConnection(resolver.resolveHost())
- .thenCompose(clientCnx -> clientCnx.newLookup(request10,
reqId10));
+ .thenCompose(clientCnx -> {
+ CompletableFuture<?> future =
clientCnx.newLookup(request10, reqId10);
+ // pending other responses in `ClientCnx` until now
+ latch[0].countDown();
Review Comment:
Why not code like this (Simpler and better understood)?:
```java
latch[0] = new CountDownLatch(1);
f1 = pool.getConnection(resolver.resolveHost()).thenCompose(clientCnx ->
clientCnx.newLookup(request8,reqId8));
f2 = pool.getConnection(resolver.resolveHost()).thenCompose(clientCnx ->
clientCnx.newLookup(request9, reqId9));
f3 = pool.getConnection(resolver.resolveHost()).thenCompose(clientCnx ->
clientCnx.newLookup(request9, reqId9));
latch[0].countDown();
f1.get();
f2.get();
f3.get();
fail("At least one should fail");
```
--
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]