user1389747
user1389747

Reputation: 3

jboss netty channel buffers thread safety

I'm writing small utility app (JBoss Netty based) which should perform some trivial login against http requests.

Imagine an image buffer

private static byte[] image = DatatypeConverter.parseBase64Binary("...some base64 data here....");

private static final ChannelBuffer imageBuf = ChannelBuffers.wrappedBuffer(image);

So, the question is: Is it correct to share this imageBuf across multiple threads for writing? Or should I create the new one for each response?

Upvotes: 0

Views: 414

Answers (1)

Norman Maurer
Norman Maurer

Reputation: 23567

Nope its not safe to share the ChannelBuffer accross Threads. ChannelBuffer's are not thread-safe

Upvotes: 1

Related Questions