linlinnn commented on a change in pull request #10352:
URL: https://github.com/apache/pulsar/pull/10352#discussion_r625564953
##########
File path:
pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerImpl.java
##########
@@ -1292,17 +1280,15 @@ void receiveIndividualMessagesFromBatch(MessageMetadata
msgMetadata, int redeliv
if (possibleToDeadLetter != null) {
possibleToDeadLetter.add(message);
}
- lock.readLock().lock();
- try {
+ internalPinnedExecutor.execute(() -> {
if (peekPendingReceive() != null) {
notifyPendingReceivedCallback(message, null);
} else if (enqueueMessageAndCheckBatchReceive(message) &&
hasPendingBatchReceive()) {
notifyPendingBatchReceivedCallBack();
}
- } finally {
- lock.readLock().unlock();
- }
- singleMessagePayload.release();
+ singleMessagePayload.release();
+ tryTriggerListener();
Review comment:
You put `triggerListener` into the
[cycle](https://github.com/apache/pulsar/blob/c1517ffbe21f767a1147633f71e0bc0153b5a7db/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerImpl.java#L1240)
Maybe have a bad influence when the batchSize is big
we enqueue all message and trigger once before, now we enqueue one message
and trigger one time.
What about just
```
if(){
// do some thing
}else{
// do some thing
}
internalPinnedExecutor.execute(() -> {
triggerListener();
});
```
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]