public void close(boolean forceClose) {
    if (allowClose() || forceClose) {
      LOG.debug("Closing current thread's connection to Hive Metastore.");
      if (metaStoreClient != null) {
        metaStoreClient.close();
        metaStoreClient = null;
      }
      // syncMetaStoreClient is wrapped on metaStoreClient. So, it is enough to close it once.
      syncMetaStoreClient = null;
      if (owner != null) {
        owner = null;
      }
    }
  }
Closes the connection to metastore for the calling thread if allow to close.
@param forceClose - Override the isAllowClose flag to forcefully close the MS connections.
ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java