@Override public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception { if (msg instanceof NettyMessage) { ByteBuf serialized = null; try { serialized = ((NettyMessage) msg).write(ctx.alloc()); } catch (Throwable t) { throw new IOException("Error while serializing message: " + msg, t); } finally { if (serialized != null) { ctx.write(serialized, promise); } } } else { ctx.write(msg, promise); } }
@Override public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception { if (msg instanceof NettyMessage) { ByteBuf serialized = null; try { serialized = ((NettyMessage) msg).write(ctx.alloc()); } catch (Throwable t) { throw new IOException("Error while serializing message: " + msg, t); } finally { if (serialized != null) { ctx.write(serialized, promise); } } } else { ctx.write(msg, promise); } } }
@Override public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception { if (msg instanceof NettyMessage) { ByteBuf serialized = null; try { serialized = ((NettyMessage) msg).write(ctx.alloc()); } catch (Throwable t) { throw new IOException("Error while serializing message: " + msg, t); } finally { if (serialized != null) { ctx.write(serialized, promise); } } } else { ctx.write(msg, promise); } } }
@Override public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception { if (msg instanceof NettyMessage) { ByteBuf serialized = null; try { serialized = ((NettyMessage) msg).write(ctx.alloc()); } catch (Throwable t) { throw new IOException("Error while serializing message: " + msg, t); } finally { if (serialized != null) { ctx.write(serialized, promise); } } } else { ctx.write(msg, promise); } }