codelipenghui commented on code in PR #16160:
URL: https://github.com/apache/pulsar/pull/16160#discussion_r903277386
##########
pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerBase.java:
##########
@@ -164,12 +164,14 @@ protected ConsumerBase(PulsarClientImpl client, String
topic, ConsumerConfigurat
this.batchReceivePolicy = BatchReceivePolicy.DEFAULT_POLICY;
}
- if (batchReceivePolicy.getTimeoutMs() > 0) {
+ initReceiverQueueSize();
+ }
+
+ protected void triggerBatchReceiveTimeoutTask() {
+ if (!hasBatchReceiveTimeout() && batchReceivePolicy.getTimeoutMs() >
0) {
Review Comment:
The timer thread will not access the `batchReceiveTimeout`
https://github.com/apache/pulsar/pull/16160/files#diff-7a1c869c4bbefdfc72fcee6074b4dfeeec318334d48d998c1cff5e09713b0834R951-R953
But I found another place `closeConsumerTasks` will also access the
`batchReceiveTimeout` but can happen on the IO thread, the user's thread, but
only get the `batchReceiveTimeout`, will not change it. And we have `volatile`
for `batchReceiveTimeout`.
--
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]