aboutsummaryrefslogtreecommitdiff
path: root/sql/hive-thriftserver/src
diff options
context:
space:
mode:
Diffstat (limited to 'sql/hive-thriftserver/src')
-rw-r--r--sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLCLIDriver.scala24
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
/*