aaron-ai commented on code in PR #5543:
URL: https://github.com/apache/rocketmq/pull/5543#discussion_r1026230650
##########
proxy/src/main/java/org/apache/rocketmq/proxy/processor/ConsumerProcessor.java:
##########
@@ -313,16 +313,17 @@ public CompletableFuture<Set<MessageQueue>>
lockBatchMQ(ProxyContext ctx, Set<Me
Set<MessageQueue> successSet = new CopyOnWriteArraySet<>();
Set<AddressableMessageQueue> addressableMessageQueueSet =
buildAddressableSet(mqSet);
Map<String, List<AddressableMessageQueue>> messageQueueSetMap =
buildAddressableMapByBrokerName(addressableMessageQueueSet);
- List<CompletableFuture<Set<MessageQueue>>> futureList = new
ArrayList<>();
+ List<CompletableFuture<Void>> futureList = new ArrayList<>();
messageQueueSetMap.forEach((k, v) -> {
LockBatchRequestBody requestBody = new LockBatchRequestBody();
requestBody.setConsumerGroup(consumerGroup);
requestBody.setClientId(clientId);
requestBody.setMqSet(v.stream().map(AddressableMessageQueue::getMessageQueue).collect(Collectors.toSet()));
- CompletableFuture<Set<MessageQueue>> future0 = new
CompletableFuture<>();
+ CompletableFuture<Void> future0 = new CompletableFuture<>();
try {
- future0 = serviceManager.getMessageService().lockBatchMQ(ctx,
v.get(0), requestBody, timeoutMillis);
- future0.thenAccept(successSet::addAll);
+ future0 = serviceManager.getMessageService()
+ .lockBatchMQ(ctx, v.get(0), requestBody, timeoutMillis)
+ .thenAccept(successSet::addAll);
} catch (Throwable t) {
future0.completeExceptionally(t);
}
Review Comment:
It will be better to use `finally` before add it to list.
--
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]