From ebc25a4ddfe07a67668217cec59893bc3b8cf730 Mon Sep 17 00:00:00 2001
From: zsxwing <zsxwing@gmail.com>
Date: Fri, 1 May 2015 17:41:55 -0700
Subject: [PATCH] [SPARK-7309] [CORE] [STREAMING] Shutdown the thread pools in
 ReceivedBlockHandler and DAGScheduler

Shutdown the thread pools in ReceivedBlockHandler and DAGScheduler when stopping them.

Author: zsxwing <zsxwing@gmail.com>

Closes #5845 from zsxwing/SPARK-7309 and squashes the following commits:

6c004fd [zsxwing] Shutdown the thread pools in ReceivedBlockHandler and DAGScheduler
---
 .../src/main/scala/org/apache/spark/scheduler/DAGScheduler.scala | 1 +
 .../apache/spark/streaming/receiver/ReceivedBlockHandler.scala   | 1 +
 2 files changed, 2 insertions(+)

diff --git a/core/src/main/scala/org/apache/spark/scheduler/DAGScheduler.scala b/core/src/main/scala/org/apache/spark/scheduler/DAGScheduler.scala
index 05b8ab0d0a..5d812918a1 100644
--- a/core/src/main/scala/org/apache/spark/scheduler/DAGScheduler.scala
+++ b/core/src/main/scala/org/apache/spark/scheduler/DAGScheduler.scala
@@ -1399,6 +1399,7 @@ class DAGScheduler(
 
   def stop() {
     logInfo("Stopping DAGScheduler")
+    messageScheduler.shutdownNow()
     eventProcessLoop.stop()
     taskScheduler.stop()
   }
diff --git a/streaming/src/main/scala/org/apache/spark/streaming/receiver/ReceivedBlockHandler.scala b/streaming/src/main/scala/org/apache/spark/streaming/receiver/ReceivedBlockHandler.scala
index 4b3d9ee4b0..651b534ac1 100644
--- a/streaming/src/main/scala/org/apache/spark/streaming/receiver/ReceivedBlockHandler.scala
+++ b/streaming/src/main/scala/org/apache/spark/streaming/receiver/ReceivedBlockHandler.scala
@@ -190,6 +190,7 @@ private[streaming] class WriteAheadLogBasedBlockHandler(
 
   def stop() {
     writeAheadLog.close()
+    executionContext.shutdown()
   }
 }
 
-- 
GitLab