try {
if (ByteBuf.class.isAssignableFrom(msg.getClass())) {
publishBytesRead((ByteBuf) msg);
} else if (ByteBufHolder.class.isAssignableFrom(msg.getClass())) {
ByteBufHolder holder = (ByteBufHolder) msg;
publishBytesRead(holder.content());
}
} catch (Exception e) {
logger.warn("Failed to publish bytes read metrics event. This does *not* stop the pipeline processing.", e);
} finally {
super.channelRead(ctx, msg);