You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2020/09/01 14:06:57 UTC
[GitHub] [flink] dugenkui03 commented on a change in pull request #13277: [FLINK-19089][Connectors / Kafka] Replace ReentrantLock with ReentrantReadWriteLock in ClosableBlockingQueue
dugenkui03 commented on a change in pull request #13277:
URL: https://github.com/apache/flink/pull/13277#discussion_r481163983
##########
File path: flink-connectors/flink-connector-kafka-base/src/main/java/org/apache/flink/streaming/connectors/kafka/internals/ClosableBlockingQueue.java
##########
@@ -176,17 +178,17 @@ public boolean close() {
public boolean addIfOpen(E element) {
requireNonNull(element);
- lock.lock();
+ writeLock.lock();
try {
if (open) {
elements.addLast(element);
if (elements.size() == 1) {
- nonEmpty.signalAll();
+ nonEmpty.signal();
Review comment:
`signal()` is safe and reasonable, since all the threads which waiting on the `nonEmpty` Condition wish to take element from queue, and at most one thread can get element from queue.
----------------------------------------------------------------
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:
users@infra.apache.org