If i cache the Channel [ctx.channel()
] instead of caching the ChannelHandlerContext does it make any difference?
Here is the step of implementation and questions:
- Netty server handler receives message from client
- Because there are other running threads to process the user data, we need to put this request to a queue and let the worker process
- We need to have the same connection used for multiple message exchange between the server and client
whenever a message is ready to send to client from the worker thread is it good practice to use the channel cached in the HashMap
final ChannelFuture status = channel.writeAndFlush(Unpooled.copiedBuffer(payload.getBytes()));
And whenever worker thread wants to close the connection with the client, if we close the cached channel, Is that is sufficient?
see this Netty - can I cache those ChannelHandlerContext in Hash map and response it later?.
Above one is about using the ChannelHandlerContext, but mine is about the channel. Also is there any advantage in using ChannelHandlerContext vs Channel
Thank you all