junrao commented on code in PR #14406:
URL: https://github.com/apache/kafka/pull/14406#discussion_r1346179200


##########
clients/src/main/java/org/apache/kafka/clients/consumer/internals/FetchBuffer.java:
##########
@@ -37,7 +36,7 @@
  *
  * <em>Note</em>: this class is not thread-safe and is intended to only be 
used from a single thread.
  */
-public class FetchBuffer implements Closeable {
+public class FetchBuffer implements AutoCloseable {

Review Comment:
   @kirktrue : Thanks for the explanation. Two followup questions.
   1. The background thread has the following path` FetchRequestManager.poll  
-> handleFetchResponse -> fetchBuffer.add(completedFetch)`. So, it seems that 
the background thread also writes the fetched data to `fetchBuffer`.
   2. This is related to my other 
[comment](https://github.com/apache/kafka/pull/14406#discussion_r1342984775). 
The background thread has the following path `FetchRequestManager.poll  -> 
AbstractFetch.prepareFetchRequests -> AbstractFetch.fetchablePartitions -> 
reads fetchBuffer.bufferedPartitions()`. Since fetchBuffer is written by the 
application thread, how do we coordinate the synchronization btw the two 
threads?



-- 
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: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to