Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Modified the timing of shutdown hook execution. It should be executed…
… before shutdown hook of o.a.h.f.FileSystem
  • Loading branch information
sarutak committed Aug 11, 2014
commit 6c0997c5c286d80503bbe1423902318571663365
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ import jline.{ConsoleReader, History}
import org.apache.commons.lang.StringUtils
import org.apache.commons.logging.LogFactory
import org.apache.hadoop.conf.Configuration
import org.apache.hadoop.fs.FileSystem
import org.apache.hadoop.util.ShutdownHookManager
import org.apache.hadoop.hive.cli.{CliDriver, CliSessionState, OptionsProcessor}
import org.apache.hadoop.hive.common.LogUtils.LogInitializationException
import org.apache.hadoop.hive.common.{HiveInterruptCallback, HiveInterruptUtils, LogUtils}
Expand Down Expand Up @@ -116,13 +118,14 @@ private[hive] object SparkSQLCLIDriver {
SessionState.start(sessionState)

// Clean up after we exit
Runtime.getRuntime.addShutdownHook(
// This should be executed before shutdown hook of FileSystem to avoid race condition of FileSystem operation
ShutdownHookManager.get.addShutdownHook(
new Thread() {
override def run() {
SparkSQLEnv.stop()
}
}
)
, FileSystem.SHUTDOWN_HOOK_PRIORITY - 1)

// "-h" option has been passed, so connect to Hive thrift server.
if (sessionState.getHost != null) {
Expand Down