pnowojski commented on a change in pull request #10009: [FLINK-14304] Avoid task starvation with mailbox URL: https://github.com/apache/flink/pull/10009#discussion_r342963223
########## File path: flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/mailbox/TaskMailboxImpl.java ########## @@ -185,31 +171,19 @@ private Mail takeHeadInternal(int priority) throws IllegalStateException { } } - private boolean isEmpty() { - return count == 0; - } - - private boolean isPutAbleState() { - return state == State.OPEN; - } - - private boolean isTakeAbleState() { - return state != State.CLOSED; - } - private void checkPutStateConditions() { final State state = this.state; - if (!isPutAbleState()) { + if (this.state != OPEN) { Review comment: I mean instead `if (condition) throw new IllegalStateException(msg)` you can just replace it with `checkState(condition, msg)? But ok, `checkPutStateConditions` could be on the hot path, so it might be a good idea to hide creating the `msg` inside the `if` branch, so the message is not created every time. ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services