diff --git beeline/src/java/org/apache/hive/beeline/BeeLine.java beeline/src/java/org/apache/hive/beeline/BeeLine.java index abeff02..a29ea37 100644 --- beeline/src/java/org/apache/hive/beeline/BeeLine.java +++ beeline/src/java/org/apache/hive/beeline/BeeLine.java @@ -1184,7 +1184,7 @@ private void setupHistory() throws IOException { } this.history = new FileHistory(new File(getOpts().getHistoryFile())); - // add shutdown hook to flush the history to history file + // add shutdown hook to flush the history to history file and to close all open connections ShutdownHookManager.addShutdownHook(new Runnable() { @Override public void run() { @@ -1192,6 +1192,8 @@ public void run() { history.flush(); } catch (IOException e) { error(e); + } finally { + close(); } } });