public List<JobItemBean> getJobStatus(ArrayList<String> jobIds, String user, boolean showall,
                                       String jobId, int numRecords, boolean showDetails)
                                       throws IOException, InterruptedException {

    List<JobItemBean> detailList = new ArrayList<JobItemBean>();
    int currRecord = 0;

    // Sort the list as requested
    boolean isAscendingOrder = true;
    switch (appConf.getListJobsOrder()) {
    case lexicographicaldesc:
      Collections.sort(jobIds, Collections.reverseOrder());
      isAscendingOrder = false;
      break;
    case lexicographicalasc:
    default:
      Collections.sort(jobIds);
      break;
    }

    for (String job : jobIds) {
      // If numRecords = -1, fetch all records.
      // Hence skip all the below checks when numRecords = -1.
      if (numRecords != -1) {
        // If currRecord >= numRecords, we have already fetched the top #numRecords
        if (currRecord >= numRecords) {
          break;
        }
        else if (jobId == null || jobId.trim().length() == 0) {
            currRecord++;
        }
        // If the current record needs to be returned based on the
        // filter conditions specified by the user, increment the counter
        else if (isAscendingOrder && job.compareTo(jobId) > 0 || !isAscendingOrder && job.compareTo(jobId) < 0) {
          currRecord++;
        }
        // The current record should not be included in the output detailList.
        else {
          continue;
        }
      }
      JobItemBean jobItem = new JobItemBean();
      jobItem.id = job;
      if (showDetails) {
        StatusDelegator sd = new StatusDelegator(appConf);
        try {
          jobItem.detail = sd.run(user, job, false);
        }
        catch(Exception ex) {
          /*
           * if we could not get status for some reason, log it, and send empty status back with
           * just the ID so that caller knows to even look in the log file
           */
          LOG.info("Failed to get status detail for jobId='" + job + "'", ex);
          jobItem.detail = new QueueStatusBean(job, "Failed to retrieve status; see WebHCat logs");
        }
      }
      detailList.add(jobItem);
    }

    return detailList;
  }
Current thread id used to set in execution threads.
hcatalog/webhcat/svr/src/main/java/org/apache/hive/hcatalog/templeton/ListDelegator.java