public QueueStatusBean getJobStatus(String user, String id)
    throws NotAuthorizedException, BadParam, IOException, InterruptedException
  {
    WebHCatJTShim tracker = null;
    JobState state = null;
    UserGroupInformation ugi = null;
    try {
      ugi = UgiFactory.getUgi(user);
      tracker = ShimLoader.getHadoopShims().getWebHCatShim(appConf, ugi);
      JobID jobid = StatusDelegator.StringToJobID(id);
      if (jobid == null)
        throw new BadParam("Invalid jobid: " + id);
      state = new JobState(id, Main.getAppConfigInstance());
      return StatusDelegator.makeStatus(tracker, jobid, state);
    } catch (IllegalStateException e) {
      throw new BadParam(e.getMessage());
    } finally {
      if (tracker != null)
        tracker.close();
      if (state != null)
        state.close();
      if (ugi != null)
        FileSystem.closeAllForUGI(ugi);
    }
  }
Current thread id used to set in execution threads.
hcatalog/webhcat/svr/src/main/java/org/apache/hive/hcatalog/templeton/StatusDelegator.java