You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2020/06/12 17:38:19 UTC

[GitHub] [kafka] abbccdda commented on a change in pull request #8857: KAFKA-10157: Fix broken tests due to InterruptedException from FinalizedFeatureChangeListener

abbccdda commented on a change in pull request #8857:
URL: https://github.com/apache/kafka/pull/8857#discussion_r439556229



##########
File path: core/src/main/scala/kafka/server/FinalizedFeatureChangeListener.scala
##########
@@ -143,10 +142,15 @@ class FinalizedFeatureChangeListener(zkClient: KafkaZkClient) extends Logging {
   private class ChangeNotificationProcessorThread(name: String) extends ShutdownableThread(name = name) {
     override def doWork(): Unit = {
       try {
-        ignoring(classOf[InterruptedException]) {
-          queue.take.updateLatestOrThrow()
-        }
+        queue.take.updateLatestOrThrow()
       } catch {
+        case ie: InterruptedException =>
+          // While the queue is empty and this thread is blocking on taking an item from the queue,
+          // a concurrent call to FinalizedFeatureChangeListener.close() could interrupt the thread
+          // and cause an InterruptedException to be raised from queue.take(). In such a case, it is
+          // safe to ignore the exception if the thread is being shutdown. We raise the exception
+          // here again, because, it is ignored by ShutdownableThread if it is shutting down.

Review comment:
       nit: if it is shutting down -> when shutting down.




----------------------------------------------------------------
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