ChannelHandler.handlerRemoved() must be invoked *after* the handler has been removed completely and its buffers should be inaccessible.
This commit is contained in:
parent
a68d39fcf2
commit
c72b5341a3
@ -190,12 +190,13 @@ import java.lang.annotation.Target;
|
||||
public interface ChannelHandler {
|
||||
|
||||
/**
|
||||
* Gets called after the {@link ChannelHandler} was added to the actual context.
|
||||
* Gets called after the {@link ChannelHandler} was added to the actual context and it's ready to handle events.
|
||||
*/
|
||||
void handlerAdded(ChannelHandlerContext ctx) throws Exception;
|
||||
|
||||
/**
|
||||
* Gets called after the {@link ChannelHandler} was removed from the actual context.
|
||||
* Gets called after the {@link ChannelHandler} was removed from the actual context and it doesn't handle events
|
||||
* anymore.
|
||||
*/
|
||||
void handlerRemoved(ChannelHandlerContext ctx) throws Exception;
|
||||
|
||||
|
@ -548,14 +548,13 @@ final class DefaultChannelPipeline implements ChannelPipeline {
|
||||
|
||||
// Notify the complete removal.
|
||||
try {
|
||||
ctx.forwardBufferContentAndRemove(ctxPrev, ctxNext);
|
||||
handler.handlerRemoved(ctx);
|
||||
} catch (Throwable t) {
|
||||
fireExceptionCaught(new ChannelPipelineException(
|
||||
ctx.handler().getClass().getName() +
|
||||
".afterRemove() has thrown an exception.", t));
|
||||
}
|
||||
|
||||
ctx.forwardBufferContentAndRemove(ctxPrev, ctxNext);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user