I'm having a hard time figuring out how to setup a non-blocking IO (network sockets) using msgpack. The write portion is trivial since msgpack can generate a ByteBuffer
fairly easily, but I can't figure out how to do non-blocking read into the MessagePack object. Looking at MessagePack.read()
there are three primary options... read(InputStream in)
, read(byte[] b)
and read(ByteBuffer b)
. All of which are blocking operations.
The reason i'm trying to go to a non-blocking transport is my server could need hundreds of simultaneous long-lived connections.
Any suggestions? It seems on my googling that most people just use msgpack with blocking IO. The only option I can think of is