codelipenghui commented on code in PR #18315:
URL: https://github.com/apache/pulsar/pull/18315#discussion_r1020086041
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentDispatcherMultipleConsumers.java:
##########
@@ -549,31 +549,51 @@ public final synchronized void
readEntriesComplete(List<Entry> entries, Object c
log.debug("[{}] Distributing {} messages to {} consumers", name,
entries.size(), consumerList.size());
}
+ sendMessagesToConsumers(readType, entries);
+ }
+
+ protected synchronized void sendInProgressAcquire() {
+ sendInProgress = true;
+ }
+
+ protected synchronized void sendInProgressRelease() {
+ sendInProgress = false;
+ }
+
+ protected synchronized boolean sendInProgress() {
+ return sendInProgress;
+ }
+
+ protected final synchronized void sendMessagesToConsumers(ReadType
readType, List<Entry> entries) {
+ java.util.function.Consumer<Boolean> consumer = asyncRead -> {
Review Comment:
Is it possible to avoid creating a new `java.util.function.Consumer` for
each consumer's message dispatching?
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentDispatcherMultipleConsumers.java:
##########
@@ -549,31 +549,51 @@ public final synchronized void
readEntriesComplete(List<Entry> entries, Object c
log.debug("[{}] Distributing {} messages to {} consumers", name,
entries.size(), consumerList.size());
}
+ sendMessagesToConsumers(readType, entries);
+ }
+
+ protected synchronized void sendInProgressAcquire() {
+ sendInProgress = true;
+ }
+
+ protected synchronized void sendInProgressRelease() {
Review Comment:
nit:
```suggestion
protected synchronized void releaseSendInProgress() {
```
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentDispatcherMultipleConsumers.java:
##########
@@ -549,31 +549,51 @@ public final synchronized void
readEntriesComplete(List<Entry> entries, Object c
log.debug("[{}] Distributing {} messages to {} consumers", name,
entries.size(), consumerList.size());
}
+ sendMessagesToConsumers(readType, entries);
+ }
+
+ protected synchronized void sendInProgressAcquire() {
+ sendInProgress = true;
+ }
+
+ protected synchronized void sendInProgressRelease() {
+ sendInProgress = false;
+ }
+
+ protected synchronized boolean sendInProgress() {
Review Comment:
nit:
```suggestion
protected synchronized boolean isSendInProgress() {
```
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentDispatcherMultipleConsumers.java:
##########
@@ -549,31 +549,51 @@ public final synchronized void
readEntriesComplete(List<Entry> entries, Object c
log.debug("[{}] Distributing {} messages to {} consumers", name,
entries.size(), consumerList.size());
}
+ sendMessagesToConsumers(readType, entries);
+ }
+
+ protected synchronized void sendInProgressAcquire() {
Review Comment:
nit:
```suggestion
protected synchronized void acquireSendInProgress() {
```
--
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]