public static void restoreSessionSpecifiedClassLoader(ClassLoader prev) {
    SessionState state = SessionState.get();
    if (state != null && state.getConf() != null) {
      ClassLoader current = state.getConf().getClassLoader();
      if (current != prev && JavaUtils.closeClassLoadersTo(current, prev)) {
        Thread.currentThread().setContextClassLoader(prev);
        state.getConf().setClassLoader(prev);
      }
    }
  }
get session specified class loader and get current class loader if fall

@return
ql/src/java/org/apache/hadoop/hive/ql/exec/Utilities.java