You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2020/02/04 03:25:16 UTC

[GitHub] [spark] Ngone51 commented on a change in pull request #26674: [SPARK-30059][CORE]Stop AsyncEventQueue when interrupted in dispatch

Ngone51 commented on a change in pull request #26674: [SPARK-30059][CORE]Stop AsyncEventQueue when interrupted in dispatch
URL: https://github.com/apache/spark/pull/26674#discussion_r374457613
 
 

 ##########
 File path: core/src/test/scala/org/apache/spark/scheduler/SparkListenerSuite.scala
 ##########
 @@ -627,6 +673,25 @@ class SparkListenerSuite extends SparkFunSuite with LocalSparkContext with Match
       }
     }
   }
+
+  /**
+   * A simple listener that interrupts on job end asynchronously.
+   */
+  private class AsyncInterruptingListener extends SparkListener {
+    @volatile var sleep = true
+
+    override def onJobEnd(jobEnd: SparkListenerJobEnd): Unit = {
+      val listenerThread = Thread.currentThread()
+      new Thread(new Runnable {
+        override def run(): Unit = {
+          while (sleep) {
+            Thread.sleep(10)
+          }
+          listenerThread.interrupt()
+        }
+      }).start()
 
 Review comment:
   Does it means that `EventLogListener` does similar thing like this inside?

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


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org