Join the Stack Overflow Community
Stack Overflow is a community of 6.4 million programmers, just like you, helping each other.
Join them; it only takes a minute:
Sign up
public Message unmarshalMessage(SourceMessaageType src, MyMessageType dest) {
    final byte[] payload = src.getText();
    final ByteBufferRefManager bufferManager = byteBufferPool.getBuffer(payload .length);
    ByteBuffer writeBuf = bufferManager.getByteBuffer();
    dest.setBufferRefManager(bufferManager);

    //This line throws BufferOverflowException()
    writeBuf.put(payload);
    writeBuf.flip();
}

src.getText() always returns a not null byte array.

My application received lot of messages over a cloud, parse those into destination message format and publishes it to destination. It a low latency application and sometimes receives around thousand messages per second. Sometimes while processing messages process get BufferOverflow exception in above code snapshot. It is some kind of condition that is hard to reproduce. What could be the reason of such exception?

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.