Move exceptionCaught(..) back to ChannelHandler. Related to [#1118]
This commit is contained in:
parent
faaff91dd0
commit
256c931db2
@ -209,6 +209,11 @@ public interface ChannelHandler {
|
|||||||
*/
|
*/
|
||||||
void afterRemove(ChannelHandlerContext ctx) throws Exception;
|
void afterRemove(ChannelHandlerContext ctx) throws Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets called if a {@link Throwable} was thrown.
|
||||||
|
*/
|
||||||
|
void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates that the same instance of the annotated {@link ChannelHandler}
|
* Indicates that the same instance of the annotated {@link ChannelHandler}
|
||||||
* can be added to one or more {@link ChannelPipeline}s multiple times
|
* can be added to one or more {@link ChannelPipeline}s multiple times
|
||||||
|
@ -60,4 +60,16 @@ public abstract class ChannelHandlerAdapter implements ChannelHandler {
|
|||||||
public void afterRemove(ChannelHandlerContext ctx) throws Exception {
|
public void afterRemove(ChannelHandlerContext ctx) throws Exception {
|
||||||
// NOOP
|
// NOOP
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -56,11 +56,6 @@ public interface ChannelStateHandler extends ChannelHandler {
|
|||||||
*/
|
*/
|
||||||
void inboundBufferUpdated(ChannelHandlerContext ctx) throws Exception;
|
void inboundBufferUpdated(ChannelHandlerContext ctx) throws Exception;
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets called if a {@link Throwable} was thrown.
|
|
||||||
*/
|
|
||||||
void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets called if an user event was triggered.
|
* Gets called if an user event was triggered.
|
||||||
*/
|
*/
|
||||||
|
@ -79,18 +79,6 @@ public abstract class ChannelStateHandlerAdapter extends ChannelHandlerAdapter i
|
|||||||
ctx.fireChannelReadSuspended();
|
ctx.fireChannelReadSuspended();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 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);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calls {@link ChannelHandlerContext#fireUserEventTriggered(Object)} to forward
|
* Calls {@link ChannelHandlerContext#fireUserEventTriggered(Object)} to forward
|
||||||
* to the next {@link ChannelHandler} in the {@link ChannelPipeline}.
|
* to the next {@link ChannelHandler} in the {@link ChannelPipeline}.
|
||||||
|
@ -812,7 +812,7 @@ final class DefaultChannelHandlerContext extends DefaultAttributeMap implements
|
|||||||
throw new NullPointerException("cause");
|
throw new NullPointerException("cause");
|
||||||
}
|
}
|
||||||
|
|
||||||
findContextInbound().invokeExceptionCaught(cause);
|
next.invokeExceptionCaught(cause);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1246,6 +1246,11 @@ final class DefaultChannelPipeline implements ChannelPipeline {
|
|||||||
msgSink.release();
|
msgSink.release();
|
||||||
byteSink.release();
|
byteSink.release();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
|
||||||
|
ctx.fireExceptionCaught(cause);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final class ByteHeadHandler extends HeadHandler {
|
private static final class ByteHeadHandler extends HeadHandler {
|
||||||
|
Loading…
Reference in New Issue
Block a user