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

ASF GitHub Bot commented on PROTON-881:
---------------------------------------

GitHub user prestona opened a pull request:

    https://github.com/apache/qpid-proton/pull/34

    PROTON-881: Graceful handling of runtime exceptions thrown within han…

    Adds support for more gracefully handling runtime exceptions thrown from 
within a handler.
    
    When a runtime (unchecked) exceptions is thrown within a handler, the 
reactor now catches it and throws a HandlerException (which is a checked 
exception).  The HandlerException references the Handler that threw the 
original exception and also chains the original exception as its "cause".
    
    One facet of this PR that I'm not 100% happy with is the changes to 
EventImpl.  Really EventImpl.dispatch() should throw HandlerException - but 
this would be a pretty disruptive change, so instead I've added a 'lastHandler' 
attribute to the class which remembers the last handler to be dispatched.  This 
means that if a handler throws an exception inside the dispatch() method the 
calling class can discover which handler was responsible (even if dispatch() 
has recursed  into one, or more, level of child handler).
    
    If there's a better way to do this (I'm sure it'll be really obvious in 
hindsight...), please let me know and I'll resubmit the PR with the changes.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/prestona/qpid-proton reactor

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/qpid-proton/pull/34.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #34
    
----
commit 709c76f48008e5e593b723d6d59bbbc89b0d5e97
Author: Adrian Preston <prest...@uk.ibm.com>
Date:   2015-05-25T20:22:48Z

    PROTON-881: Graceful handling of runtime exceptions thrown within handlers
    
    When a runtime (unchecked) exceptions is thrown within a handler, the 
reactor
    now catches it and throws a HandlerException (which is a checked exception).
    The HandlerException references the Handler that threw the original 
exception
    and also chains the original exception as its "cause".

----


> Proton-j reactor implementation
> -------------------------------
>
>                 Key: PROTON-881
>                 URL: https://issues.apache.org/jira/browse/PROTON-881
>             Project: Qpid Proton
>          Issue Type: Improvement
>          Components: proton-j
>    Affects Versions: 0.9
>            Reporter: Adrian Preston
>            Priority: Minor
>
> To keep the proton-j codebase consistent with proton-c - there should be a 
> native Java port of the reactor.



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

Reply via email to