Close encoder when handlerRemoved. (#9950)

Motivation:

We should close encoder when `LzfEncoder` was removed from pipeline.

Modification:

call `encoder.close` when `handlerRemoved` triggered.

Result:

Close encoder to release internal buffer.
This commit is contained in:
时无两丶 2020-01-14 17:51:30 +08:00 committed by Norman Maurer
parent 727f03755c
commit de690daccc
1 changed files with 6 additions and 0 deletions

View File

@ -137,4 +137,10 @@ public class LzfEncoder extends MessageToByteEncoder<ByteBuf> {
recycler.releaseInputBuffer(input);
}
}
@Override
public void handlerRemoved(ChannelHandlerContext ctx) throws Exception {
encoder.close();
super.handlerRemoved(ctx);
}
}