You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mapreduce-issues@hadoop.apache.org by "Yang Hao (JIRA)" <ji...@apache.org> on 2017/10/24 10:34:00 UTC

[jira] [Issue Comment Deleted] (MAPREDUCE-6296) A better way to deal with InterruptedException on waitForCompletion

     [ https://issues.apache.org/jira/browse/MAPREDUCE-6296?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Yang Hao updated MAPREDUCE-6296:
--------------------------------
    Comment: was deleted

(was: Hi Steve, I have used the findbugs to analyze Slider, and it seems there are some possible bugs)

> A better way to deal with InterruptedException on waitForCompletion
> -------------------------------------------------------------------
>
>                 Key: MAPREDUCE-6296
>                 URL: https://issues.apache.org/jira/browse/MAPREDUCE-6296
>             Project: Hadoop Map/Reduce
>          Issue Type: Improvement
>            Reporter: Yang Hao
>            Assignee: Yang Hao
>              Labels: BB2015-05-TBR
>         Attachments: MAPREDUCE-6296.patch
>
>
> Some code in method waitForCompletion of Job class is 
> {code:title=Job.java|borderStyle=solid}
>   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();
>   }
> {code}
> but a better way to deal with InterruptException is
> {code:title=Job.java|borderStyle=solid}
>   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();
>   }
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: mapreduce-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: mapreduce-issues-help@hadoop.apache.org