curator-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CURATOR-219) Avoid use of Throwable
Date Sat, 02 Apr 2016 13:59:25 GMT

    [ https://issues.apache.org/jira/browse/CURATOR-219?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15222897#comment-15222897
] 

ASF GitHub Bot commented on CURATOR-219:
----------------------------------------

Github user SamG1000 commented on a diff in the pull request:

    https://github.com/apache/curator/pull/78#discussion_r58293712
  
    --- Diff: curator-client/src/main/java/org/apache/curator/ensemble/exhibitor/ExhibitorEnsembleProvider.java
---
    @@ -301,7 +301,7 @@ else if ( port != thePort )
                         values.putAll(decodeExhibitorList(encoded));
                         done = true;
                     }
    -                catch ( Throwable e )
    +                catch ( Exception e )
    --- End diff --
    
    You also need to \worry about ThreadDeath error:
    
    https://docs.oracle.com/javase/7/docs/api/java/lang/ThreadDeath.html
    ```
    An application should catch instances of this class only if it must clean up after being
terminated asynchronously. If ThreadDeath is caught by a method, it is important that it be
rethrown so that the thread actually dies.
    ```
    
    So ThreadDeath Error can be logged, but should never retry to avoid destabilizing JVM.


> Avoid use of Throwable
> ----------------------
>
>                 Key: CURATOR-219
>                 URL: https://issues.apache.org/jira/browse/CURATOR-219
>             Project: Apache Curator
>          Issue Type: Bug
>            Reporter: Mike Drob
>            Assignee: Jordan Zimmerman
>             Fix For: awaiting-response
>
>
> We liberally catch {{Throwable}} in our code, which can mask more troubling issues like
{{OutOfMemory}} or other errors. In most cases we should be catching Exception instead.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message