AHeise commented on a change in pull request #10009: [FLINK-14304] Avoid task
starvation with mailbox
URL: https://github.com/apache/flink/pull/10009#discussion_r342587553
##########
File path:
flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/mailbox/TaskMailboxImpl.java
##########
@@ -172,13 +172,17 @@ private Mail takeHeadInternal(int priority) throws
IllegalStateException {
return null;
}
- private void drainAllMails(List<Runnable> drainInto) {
- assert lock.isHeldByCurrentThread();
- for (Mail mail : queue) {
- drainInto.add(mail.getRunnable());
+ @Override
+ public List<Mail> drain() {
+ final ReentrantLock lock = this.lock;
+ lock.lock();
Review comment:
Not afaik. The whole idea of ReentrantLock is to make it as fast as possible.
`The method will return immediately if the current thread already owns the
lock.`
I would avoid that on the hotpath, but we are talking about life-cycle
methods here.
----------------------------------------------------------------
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]
With regards,
Apache Git Services