diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/tez/TezSessionPoolManager.java b/ql/src/java/org/apache/hadoop/hive/ql/exec/tez/TezSessionPoolManager.java index dfa539f535..98c5bf8de8 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/exec/tez/TezSessionPoolManager.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/tez/TezSessionPoolManager.java @@ -165,15 +165,25 @@ private TezSessionState getNewSessionState(HiveConf conf, } public void returnSession(TezSessionState tezSessionState) - throws Exception { - if (tezSessionState.isDefault()) { - LOG.info("The session " + tezSessionState.getSessionId() - + " belongs to the pool. Put it back in"); - SessionState sessionState = SessionState.get(); - if (sessionState != null) { - sessionState.setTezSession(null); + throws Exception { + boolean isInterrupted = Thread.interrupted(); + try { + if (isInterrupted) { + LOG.info("returnSession invoked with interrupt status set"); + } + if (tezSessionState.isDefault()) { + LOG.info("The session " + tezSessionState.getSessionId() + + " belongs to the pool. Put it back in"); + SessionState sessionState = SessionState.get(); + if (sessionState != null) { + sessionState.setTezSession(null); + }defaultQueuePool.put(tezSessionState); + }// non default session nothing changes. The user can continue to use the existing + // session in the SessionState + }finally { + if (isInterrupted) { + Thread.currentThread().interrupt(); } - defaultQueuePool.put(tezSessionState); } // non default session nothing changes. The user can continue to use the existing // session in the SessionState