GitHub user huxihx opened a pull request: https://github.com/apache/kafka/pull/3586
KAFKA-5665: Heartbeat thread should use correct interruption method to restore status When interrupting the background heartbeat thread, `Thread.interrupted();` is used. Actually, `Thread.currentThread().interrupt();` should be used to restore the interruption status. An alternative way to solve is to remove `Thread.interrupted();` since HeartbeatThread extends Thread and all code higher up on the call stack is controlled, so we could safely swallow this exception. Anyway, `Thread.interrupted();` should not be used here. It's a test method not an action. You can merge this pull request into a Git repository by running: $ git pull https://github.com/huxihx/kafka KAFKA-5665 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/kafka/pull/3586.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #3586 ---- commit 36d489eede2229db92eda077ae4baff80044fb25 Author: huxihx <huxi...@hotmail.com> Date: 2017-07-27T03:53:21Z KAFKA-5665: Incorrect interruption invoking method used for Heartbeat thread When interrupting the background heartbeat thread, `Thread.interrupted();` is used. Actually, `Thread.currentThread().interrupt();` should be used to restore the interruption status. An alternative way to solve is to remove `Thread.interrupted();` since HeartbeatThread extends Thread and all code higher up on the call stack is controlled, so we could safely swallow this exception. Anyway, `Thread.interrupted();` should not be used here. It's a test method not an action. ---- --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---