looking for best netty classes to use for in-memory streaming between threads
-
26-10-2019 - |
题
I'm looking for a recommendation on the best netty class(es) to use that support the following functionality:
- in-memory, local JVM communication
- stream-based
- support multiple threads writing binary data into the stream
- SINGLE thread reading the data from the stream
- is thread-safe on the writing side
- automatically handles the underlying byte array growth
- supports configurable timeout on the READing thread
At first glance, the ChunkedWriteHandler + either the ChunkedNioStream or ChunkedStream classes look like the best approach, but I don't know from reading the documentation if they meet all the requirements above.
If anyone can provide some direction/recommendation, it would be greatly appreciated!
Thanks, Bob
UPDATE: after digging some more, should I be looking at ChannelBufferInputStream and ChannelBufferOutputStream? Not having used Netty yet, I'm still coming up to speed on what pieces are used where.
解决方案
I'm a bit confused.. Can you give some more details about the use case ? Normally you don't want to use "blocking" operations with netty. For VM communication you should checkout the local package: http://netty.io/docs/stable/api/org/jboss/netty/channel/local/package-frame.html