New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move exceptionCaught(..) and userEventTriggered(..) to ChannelStateHandler #1107
Comments
@trustin wdyt ? |
w.r.t to moving those from "base" ChannelHandler to the "upstream" ChannelHandler, that sounds find by me since they are "upstream" messages - sry about the netty3 syntax, not going to try to context swap this early in the morning :) Not sure I agree with the second statement you made though. exceptionCaught(..) can be called because of an outband operation and some Netty handlers rely on this -- WriteTimeoutHandler for example |
This leads myself to an interesting idea: how about just merging I wonder how much this will affect the performance. It will make the call stack deeper but it will make pipeline implementation simpler. |
Then we could also merge ChannelHandler in... Maybe a good idea! Sent from my iPhone. Excuse any typos.... Am 28.02.2013 um 18:49 schrieb Trustin Lee notifications@github.com:
|
@trustin just noticed this is exactly what you said... So deal ? |
Deal. Another breakage :-) |
yeah... I will take care, so we both are guilty ;) |
Just make sure there's no perf regression. :-) |
Yeah will test... If it really makes a big difference we can just do what I proposed before Sent from my iPhone. Excuse any typos.... Am 28.02.2013 um 19:52 schrieb Trustin Lee notifications@github.com:
|
@trustin one think I just notice is that it will break our ChannelDuplexHandler as it is not easy to combine two handlers anymore.. maybe we should just go with my first idea.. WDYT ? |
Sorry I was talking about CombinedChannelDuplexHandler |
@trustin so any preference ? I would like to just move the two methods... |
-1 to merging them it will break all of the combined encoder/decoder codecs |
@jpinner yeah that is why I just want to move the two methods. As otherwise it impossible to combine. |
Agreed. #1111 looks fine to me. Let's merge! |
merged in.. thanks! |
I think we should re-open this and think again about it. After my work on out-of-order events in the pipeline I think again we should move the exceptionCaught(...) method to ChannelStateHandler. This will also make the contract clear in which direction the pipeline is processed. If someone wants to react on exceptionCaught and its own impl is only a ChannelOperationHandler he just need to add another handler in or make his handler also implement ChannelStateHandler. |
So for example the ReadTimeoutHandler would just extend ChannelDuplexHandler. |
I see no problem with the current contract? Also, if we move it to ChannelStateHandler, an operation handler that raised an exception mistakenly can never be notified. Norman Maurer notifications@github.com wrote:
sent from a mobile device |
s/notified/notified to the operation handler which raised the exception/ Trustin Lee notifications@github.com wrote:
sent from a mobile device |
I would even say we should remove throw Exception from all methods for a operation handler as it should notify the promise on failure, no? Am 20.04.2013 um 05:48 schrieb Trustin Lee notifications@github.com:
|
That's an interesting idea. I don't think we need to remove 'throws Exception' but just need to catch it in DefaultChannelHandlerContext. However, we can't notify the caught exception if the handler already forwarded the promise to the next handler or the promise has been fulfilled. Norman Maurer notifications@github.com wrote:
sent from a mobile device |
That's true but it just doesn't sound right to allow throw an exception if a promise is passed in. It makes the contract more clear, at least for me ;) Am 20.04.2013 um 09:31 schrieb Trustin Lee notifications@github.com:
|
Also if already notify we can just log the exception and close the channel. As this is most likely a user error / bug. Am 20.04.2013 um 09:31 schrieb Trustin Lee notifications@github.com:
|
@trustin I think once we know if we should change this or not we can just cut CR2 as I don't think the pipeline lifecycle stuff will need any api changes to get fixed. CR2 is long overdue... I would change it ;) |
As we agreed to disagree, I'm going to close this for now. ;-) |
@normanmaurer I do think the overdue doesn't matter but the quality matters. |
While I was working on the Netty in Action book I notice something I would like to change in our current ChannelHandler hierarchy. So here we go.
I think we should exceptionCaught(..) and userEventTriggered(..) to ChannelStateHandler (currently in ChannelHandler).
The main reasons are:
The text was updated successfully, but these errors were encountered: