Make all encoder/decoder methods overridable in MessageToMessageCodec

This commit is contained in:
Trustin Lee 2013-01-09 14:44:19 +09:00
parent 8d0785da36
commit 4a3d73724f

View File

@ -64,6 +64,11 @@ public abstract class MessageToMessageCodec<INBOUND_IN, INBOUND_OUT, OUTBOUND_IN
public OUTBOUND_OUT encode(ChannelHandlerContext ctx, OUTBOUND_IN msg) throws Exception { public OUTBOUND_OUT encode(ChannelHandlerContext ctx, OUTBOUND_IN msg) throws Exception {
return MessageToMessageCodec.this.encode(ctx, msg); return MessageToMessageCodec.this.encode(ctx, msg);
} }
@Override
protected void freeOutboundMessage(OUTBOUND_IN msg) throws Exception {
MessageToMessageCodec.this.freeOutboundMessage(msg);
}
}; };
private final MessageToMessageDecoder<INBOUND_IN, INBOUND_OUT> decoder = private final MessageToMessageDecoder<INBOUND_IN, INBOUND_OUT> decoder =
@ -77,6 +82,11 @@ public abstract class MessageToMessageCodec<INBOUND_IN, INBOUND_OUT, OUTBOUND_IN
public INBOUND_OUT decode(ChannelHandlerContext ctx, INBOUND_IN msg) throws Exception { public INBOUND_OUT decode(ChannelHandlerContext ctx, INBOUND_IN msg) throws Exception {
return MessageToMessageCodec.this.decode(ctx, msg); return MessageToMessageCodec.this.decode(ctx, msg);
} }
@Override
protected void freeInboundMessage(INBOUND_IN msg) throws Exception {
MessageToMessageCodec.this.freeInboundMessage(msg);
}
}; };
private final Class<?>[] acceptedInboundMsgTypes; private final Class<?>[] acceptedInboundMsgTypes;
@ -143,4 +153,12 @@ public abstract class MessageToMessageCodec<INBOUND_IN, INBOUND_OUT, OUTBOUND_IN
protected abstract OUTBOUND_OUT encode(ChannelHandlerContext ctx, OUTBOUND_IN msg) throws Exception; protected abstract OUTBOUND_OUT encode(ChannelHandlerContext ctx, OUTBOUND_IN msg) throws Exception;
protected abstract INBOUND_OUT decode(ChannelHandlerContext ctx, INBOUND_IN msg) throws Exception; protected abstract INBOUND_OUT decode(ChannelHandlerContext ctx, INBOUND_IN msg) throws Exception;
protected void freeInboundMessage(INBOUND_IN msg) throws Exception {
ChannelHandlerUtil.freeMessage(msg);
}
protected void freeOutboundMessage(OUTBOUND_IN msg) throws Exception {
ChannelHandlerUtil.freeMessage(msg);
}
} }