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?