Mark ChannelHandler.exceptionCaught(...) as deprecated in preparation to move to ChannelInboundHandler. Related to [#1808]

This commit is contained in:
Norman Maurer 2013-09-08 20:11:51 +02:00
parent 363531caf9
commit af499b5fb4
4 changed files with 24 additions and 0 deletions

View File

@ -194,7 +194,12 @@ public interface ChannelHandler {
/**
* Gets called if a {@link Throwable} was thrown.
*
* @deprecated Will be removed in the future and only {@link ChannelInboundHandler} will receive
* exceptionCaught events. For {@link ChannelOutboundHandler} the {@link ChannelPromise}
* must be failed.
*/
@Deprecated
void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception;
/**

View File

@ -54,6 +54,7 @@ public abstract class ChannelHandlerAdapter implements ChannelHandler {
*
* Sub-classes may override this method to change behavior.
*/
@Deprecated
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause)
throws Exception {

View File

@ -68,4 +68,10 @@ public interface ChannelInboundHandler extends ChannelHandler {
* {@link Channel#isWritable()}.
*/
void channelWritabilityChanged(ChannelHandlerContext ctx) throws Exception;
/**
* Gets called if a {@link Throwable} was thrown.
*/
@Override
void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception;
}

View File

@ -118,4 +118,16 @@ public class ChannelInboundHandlerAdapter extends ChannelHandlerAdapter implemen
public void channelWritabilityChanged(ChannelHandlerContext ctx) throws Exception {
ctx.fireChannelWritabilityChanged();
}
/**
* Calls {@link ChannelHandlerContext#fireExceptionCaught(Throwable)} to forward
* to the next {@link ChannelHandler} in the {@link ChannelPipeline}.
*
* Sub-classes may override this method to change behavior.
*/
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause)
throws Exception {
ctx.fireExceptionCaught(cause);
}
}