[ 
https://issues.apache.org/jira/browse/HTTPCORE-165?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12613231#action_12613231
 ] 

Patrick Moore commented on HTTPCORE-165:
----------------------------------------

Not too inclined to get on yet another email list..

Final comment --- something to think about:

the IOReactorExceptionHandler is violating a good principal of interface 
design. IOReactorExceptionHandler is imposing an expected behavior on the 
CALLER -- not the IOReactorExceptionHandler implementation. If a class calls 
the IOReactorExceptionHandler the CALLER is expected to terminate. What!? Maybe 
the code that currently calls the IOReactorEH does ... but what happens if I 
implement a IOReactor that doesn't? Are bad things going to happen if my custom 
implementation of IOReactor calls your custom implementation of 
IOReactorExceptionHandler and then does NOT terminate?

Seems like you are imposing (unnecessary) conditions on the caller.





> Poor handling of CancelledKeyException with custom IOReactorExceptionHandler 
> -----------------------------------------------------------------------------
>
>                 Key: HTTPCORE-165
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-165
>             Project: HttpComponents HttpCore
>          Issue Type: Bug
>          Components: HttpCore NIO
>    Affects Versions: 4.0-beta2
>            Reporter: Patrick Moore
>             Fix For: 4.0-beta3
>
>         Attachments: cancelledkey.patch
>
>
> IOReactorExceptionHandler documentation for handle(RuntimeException ex) is 
> misleading. Specifically the documentation says :
>      @return <code>true</code> if it is safe to ignore the exception 
>      and continue execution of the I/O reactor; <code>false</code> if the
>      I/O reactor must throw [EMAIL PROTECTED] RuntimeException} and terminate 
> However, a CancelledKeyException should be rethrown because the BaseIOReactor 
> and the AbstractIOReactor expect and handle CancelledKeyException correctly.
> BUT -- NOT always.
> Looking at the call stack for where 
> IOReactorExceptionHandler.handle(RuntimeException) is called reveals some 
> problems.
> If a custom IOReactorExceptionHandler was to return false (indicating that 
> the CanceledKeyException was to be rethrown or to do the rethrow itself) 
> WOULD result in the IOReactor being shutdown:
>   BaseIOReactor.sessionClosed(IOSession)
>   BaseIOReactor.timeoutCheck(SelectionKey, long)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to