@Override
protected void encode(ChannelHandlerContext ctx, Object msg, List<Object> out) throws Exception {
if (msg instanceof MemcacheMessage) {
if (expectingMoreContent) {
throw new IllegalStateException("unexpected message type: " + StringUtil.simpleClassName(msg));
}
@SuppressWarnings({ "unchecked", "CastConflictsWithInstanceof" })
final M m = (M) msg;
out.add(encodeMessage(ctx, m));
}
if (msg instanceof MemcacheContent || msg instanceof ByteBuf || msg instanceof FileRegion) {
int contentLength = contentLength(msg);
if (contentLength > 0) {
out.add(encodeAndRetain(msg));
} else {
out.add(Unpooled.EMPTY_BUFFER);
}
expectingMoreContent = !(msg instanceof LastMemcacheContent);
}
}
AbstractMemcacheObjectEncoder.java 文件源码
java
阅读 28
收藏 0
点赞 0
评论 0
项目:couchbase-jvm-core
作者:
评论列表
文章目录