spark-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From andrewo...@apache.org
Subject spark git commit: [SPARK-9886][CORE] Fix to use ShutdownHookManager in
Date Wed, 16 Dec 2015 02:25:25 GMT
Repository: spark
Updated Branches:
  refs/heads/master 63ccdef81 -> 8a215d233


[SPARK-9886][CORE] Fix to use ShutdownHookManager in

ExternalBlockStore.scala

Author: Naveen <naveenminchu@gmail.com>

Closes #10313 from naveenminchu/branch-fix-SPARK-9886.


Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/8a215d23
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/8a215d23
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/8a215d23

Branch: refs/heads/master
Commit: 8a215d2338c6286253e20122640592f9d69896c8
Parents: 63ccdef
Author: Naveen <naveenminchu@gmail.com>
Authored: Tue Dec 15 18:25:22 2015 -0800
Committer: Andrew Or <andrew@databricks.com>
Committed: Tue Dec 15 18:25:22 2015 -0800

----------------------------------------------------------------------
 .../apache/spark/storage/ExternalBlockStore.scala   | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/8a215d23/core/src/main/scala/org/apache/spark/storage/ExternalBlockStore.scala
----------------------------------------------------------------------
diff --git a/core/src/main/scala/org/apache/spark/storage/ExternalBlockStore.scala b/core/src/main/scala/org/apache/spark/storage/ExternalBlockStore.scala
index db965d5..94883a5 100644
--- a/core/src/main/scala/org/apache/spark/storage/ExternalBlockStore.scala
+++ b/core/src/main/scala/org/apache/spark/storage/ExternalBlockStore.scala
@@ -22,7 +22,7 @@ import java.nio.ByteBuffer
 import scala.util.control.NonFatal
 
 import org.apache.spark.Logging
-import org.apache.spark.util.Utils
+import org.apache.spark.util.{ShutdownHookManager, Utils}
 
 
 /**
@@ -177,15 +177,6 @@ private[spark] class ExternalBlockStore(blockManager: BlockManager, executorId:
     }
   }
 
-  private def addShutdownHook() {
-    Runtime.getRuntime.addShutdownHook(new Thread("ExternalBlockStore shutdown hook") {
-      override def run(): Unit = Utils.logUncaughtExceptions {
-        logDebug("Shutdown hook called")
-        externalBlockManager.map(_.shutdown())
-      }
-    })
-  }
-
   // Create concrete block manager and fall back to Tachyon by default for backward compatibility.
   private def createBlkManager(): Option[ExternalBlockManager] = {
     val clsName = blockManager.conf.getOption(ExternalBlockStore.BLOCK_MANAGER_NAME)
@@ -196,7 +187,10 @@ private[spark] class ExternalBlockStore(blockManager: BlockManager, executorId:
         .newInstance()
         .asInstanceOf[ExternalBlockManager]
       instance.init(blockManager, executorId)
-      addShutdownHook();
+      ShutdownHookManager.addShutdownHook { () =>
+        logDebug("Shutdown hook called")
+        externalBlockManager.map(_.shutdown())
+      }
       Some(instance)
     } catch {
       case NonFatal(t) =>


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


Mime
View raw message