diff options
author | tedyu <yuzhihong@gmail.com> | 2015-12-16 19:02:12 -0800 |
---|---|---|
committer | Andrew Or <andrew@databricks.com> | 2015-12-16 19:02:12 -0800 |
commit | f590178d7a06221a93286757c68b23919bee9f03 (patch) | |
tree | 94e096dc45037353b602d29f1b2df7d471bcab2d /sql/hive-thriftserver/src/main | |
parent | 38d9795a4fa07086d65ff705ce86648345618736 (diff) | |
download | spark-f590178d7a06221a93286757c68b23919bee9f03.tar.gz spark-f590178d7a06221a93286757c68b23919bee9f03.tar.bz2 spark-f590178d7a06221a93286757c68b23919bee9f03.zip |
[SPARK-12365][CORE] Use ShutdownHookManager where Runtime.getRuntime.addShutdownHook() is called
SPARK-9886 fixed ExternalBlockStore.scala
This PR fixes the remaining references to Runtime.getRuntime.addShutdownHook()
Author: tedyu <yuzhihong@gmail.com>
Closes #10325 from ted-yu/master.
Diffstat (limited to 'sql/hive-thriftserver/src/main')
-rw-r--r-- | sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLCLIDriver.scala | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLCLIDriver.scala b/sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLCLIDriver.scala index 03bb2c2225..8e7aa75bc3 100644 --- a/sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLCLIDriver.scala +++ b/sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLCLIDriver.scala @@ -195,20 +195,18 @@ private[hive] object SparkSQLCLIDriver extends Logging { } // add shutdown hook to flush the history to history file - Runtime.getRuntime.addShutdownHook(new Thread(new Runnable() { - override def run() = { - reader.getHistory match { - case h: FileHistory => - try { - h.flush() - } catch { - case e: IOException => - logWarning("WARNING: Failed to write command history file: " + e.getMessage) - } - case _ => - } + ShutdownHookManager.addShutdownHook { () => + reader.getHistory match { + case h: FileHistory => + try { + h.flush() + } catch { + case e: IOException => + logWarning("WARNING: Failed to write command history file: " + e.getMessage) + } + case _ => } - })) + } // TODO: missing /* |