Uploaded image for project: 'Hadoop Map/Reduce'
  1. Hadoop Map/Reduce
  2. MAPREDUCE-6296

A better way to deal with InterruptedException on waitForCompletion

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Patch Available
    • Major
    • Resolution: Unresolved
    • None
    • None
    • None

    Description

      Some code in method waitForCompletion of Job class is

      Job.java
        public boolean waitForCompletion(boolean verbose
                                         ) throws IOException, InterruptedException,
                                                  ClassNotFoundException {
          if (state == JobState.DEFINE) {
            submit();
          }
          if (verbose) {
            monitorAndPrintJob();
          } else {
            // get the completion poll interval from the client.
            int completionPollIntervalMillis = 
              Job.getCompletionPollInterval(cluster.getConf());
            while (!isComplete()) {
              try {
                Thread.sleep(completionPollIntervalMillis);
              } catch (InterruptedException ie) {
              }
            }
          }
          return isSuccessful();
        }
      

      but a better way to deal with InterruptException is

      Job.java
        public boolean waitForCompletion(boolean verbose
                                         ) throws IOException, InterruptedException,
                                                  ClassNotFoundException {
          if (state == JobState.DEFINE) {
            submit();
          }
          if (verbose) {
            monitorAndPrintJob();
          } else {
            // get the completion poll interval from the client.
            int completionPollIntervalMillis = 
              Job.getCompletionPollInterval(cluster.getConf());
            while (!isComplete()) {
              try {
                Thread.sleep(completionPollIntervalMillis);
              } catch (InterruptedException ie) {
                Thread.currentThread().interrupt();
              }
            }
          }
          return isSuccessful();
        }
      

      Attachments

        1. MAPREDUCE-6296.patch
          0.8 kB
          Yang Hao

        Activity

          People

            yanghaogn Yang Hao
            yanghaogn Yang Hao
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated: