hadoop-common-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steve Loughran (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HADOOP-16208) Do Not Log InterruptedException in Client
Date Thu, 28 Mar 2019 22:25:00 GMT

    [ https://issues.apache.org/jira/browse/HADOOP-16208?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16804369#comment-16804369

Steve Loughran commented on HADOOP-16208:

bq. java.io.InterruptedIOException cannot wrap another Exception and I don't think a new Exception
should be thrown and lose the details of the original cause.

This is what {{Throwable.initCause()}} is for


> Do Not Log InterruptedException in Client
> -----------------------------------------
>                 Key: HADOOP-16208
>                 URL: https://issues.apache.org/jira/browse/HADOOP-16208
>             Project: Hadoop Common
>          Issue Type: Improvement
>          Components: common
>    Affects Versions: 3.2.0
>            Reporter: David Mollitor
>            Assignee: David Mollitor
>            Priority: Minor
>         Attachments: HADOOP-16208.1.patch
> {code:java}
>        } catch (InterruptedException e) {
>         Thread.currentThread().interrupt();
>         LOG.warn("interrupted waiting to send rpc request to server", e);
>         throw new IOException(e);
>       }
> {code}
> https://github.com/apache/hadoop/blob/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/Client.java#L1450
> I'm working on a project that uses an {{ExecutorService}} to launch a bunch of threads.
 Each thread spins up an HDFS client connection.  At any point in time, the program can terminate
and call {{ExecutorService#shutdownNow()}} to forcibly close vis-à-vis {{Thread#interrupt()}}.
 At that point, I get a cascade of logging from the above code and there's no easy to way
to turn it off.
> "Log and throw" is generally frowned upon, just throw the {{Exception}} and move on.
> https://community.oracle.com/docs/DOC-983543#logAndThrow

This message was sent by Atlassian JIRA

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

View raw message