Proper assertion instead of blindly clearing the OutputMessageBuf

This commit is contained in:
Trustin Lee 2013-04-04 14:11:24 +09:00
parent 7ee2adb587
commit 8a672c2800
4 changed files with 2 additions and 9 deletions

View File

@ -107,9 +107,6 @@ public abstract class ByteToMessageDecoder
protected void callDecode(ChannelHandlerContext ctx, ByteBuf in) {
boolean wasNull = false;
OutputMessageBuf out = OutputMessageBuf.get();
assert out.isEmpty();
try {
while (in.isReadable()) {
try {

View File

@ -48,7 +48,6 @@ public abstract class MessageToMessageEncoder<I> extends ChannelOutboundMessageH
@Override
public final void flush(ChannelHandlerContext ctx, I msg) throws Exception {
OutputMessageBuf out = OutputMessageBuf.get();
try {
encode(ctx, msg, out);
} catch (CodecException e) {

View File

@ -35,8 +35,7 @@ final class OutputMessageBuf extends DefaultMessageBuf<Object> {
@Override
public OutputMessageBuf get() {
OutputMessageBuf buf = super.get();
// Just to be sure
buf.clear();
assert buf.isEmpty();
return buf;
}
};
@ -46,6 +45,7 @@ final class OutputMessageBuf extends DefaultMessageBuf<Object> {
}
private OutputMessageBuf() {
super(2);
}
@Override

View File

@ -364,7 +364,6 @@ public abstract class ReplayingDecoder<S> extends ByteToMessageDecoder {
@Override
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
OutputMessageBuf out = OutputMessageBuf.get();
try {
replayable.terminate();
ByteBuf in = cumulation;
@ -396,8 +395,6 @@ public abstract class ReplayingDecoder<S> extends ByteToMessageDecoder {
boolean wasNull = false;
ByteBuf in = cumulation;
OutputMessageBuf out = OutputMessageBuf.get();
assert out.isEmpty();
try {
while (in.isReadable()) {
try {