brainlag / JavaNSQClient

Fast Java client for NSQ
MIT License
90 stars 57 forks source link

Fix ByteBuf handling for newer versions of Netty #31

Closed dpapworth closed 7 years ago

dpapworth commented 7 years ago

Hi!

I've discovered that JavaNSQClient breaks for newer versions of Netty (from 4.0.37.Final onwards), due to how byte arrays are read from ByteBufs.

This pull request fixes the issue by checking to see if the ByteBuf supports direct array access, and falls back to reading into a pre-allocated byte array if direct access isn't supported. I've tested with NSQ v0.3.8.

Thanks, Damien.

dpapworth commented 7 years ago

Thanks for merging this. Are you planning to release an RC3 release to Maven in the near future?

brainlag commented 7 years ago

Yes.