문제

Since any exception thrown in netty handler stack will generate an upstream event and eventually invoke exceptionCaught in handler the exceptions will not reach the uncaught-exception-handler. Even rethrowing that exception in exceptionCaught method doesn't help (because netty handles it again). I would like to throw (some or all) unchecked exceptions from exceptionCaught method. Is there any way to do this?

도움이 되었습니까?

해결책

No there is no way todo this. The only thing you can do about is is to handle the Exception in ExceptionCaught. Why is this a problem for you ?

다른 팁

I have to agree with Norman, I had a similar issue. I created a exceptionCaught() method and in it called my exception handling routine. The problem I encountered was my exception handling routine tried to do cleanup and call other Netty methods but that resulted in Netty getting hung.

My fix was to create a new Thread from inside exceptionCaught() that calls my exception handling routine and simple return from exceptionCaught(). This allow Netty's exception handling to finish and resume normal Netty operation. You need to put a 1 second delay inside your new thread before calling any other Netty functions as well. This will assure netty's exception handling is done before my new thread starts its clean up and calls other netty functions. It seems a bit excessive work but it works and avoids race conditions.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top