private void internalWritableBuffer() { if (writableBuffer == null) { writableBuffer = new ResetLimitWrappedActiveMQBuffer(BODY_OFFSET, buffer.duplicate(), this); if (endOfBodyPosition > 0) { writableBuffer.byteBuf().setIndex(BODY_OFFSET, endOfBodyPosition - BUFFER_HEADER_SPACE + BODY_OFFSET); writableBuffer.resetReaderIndex(); } } }
@Override public void readerIndex(int readerIndex) { changed(); if (readerIndex < limit) { readerIndex = limit; } buffer.readerIndex(readerIndex); }
public ResetLimitWrappedActiveMQBuffer(final int limit, final ByteBuf buffer, final Message message) { // a wrapped inside a wrapper will increase the stack size. // we fixed this here due to some profiling testing super(buffer); this.limit = limit; if (writerIndex() < limit) { writerIndex(limit); } readerIndex(limit); this.message = message; }
public ResetLimitWrappedActiveMQBuffer(final int limit, final ActiveMQBuffer buffer, final Message message) { // a wrapped inside a wrapper will increase the stack size. // we fixed this here due to some profiling testing this(limit, unwrap(buffer.byteBuf()).duplicate(), message); }
private void checkBuffer() throws ActiveMQException { if (writableBuffer == null) { long bodySize = this.largeMessageSize + BODY_OFFSET; if (bodySize > Integer.MAX_VALUE) { bodySize = Integer.MAX_VALUE; } initBuffer((int) bodySize); writableBuffer = new ResetLimitWrappedActiveMQBuffer(BODY_OFFSET, buffer.duplicate(), this); largeMessageController.saveBuffer(new ActiveMQOutputStream(writableBuffer)); } }
public synchronized CoreMessage encode() { checkProperties(); if (writableBuffer != null) { // The message encode takes into consideration the PacketImpl which is not part of this encoding // so we always need to take the BUFFER_HEADER_SPACE from packet impl into consideration endOfBodyPosition = writableBuffer.writerIndex() + BUFFER_HEADER_SPACE - 4; } else if (endOfBodyPosition <= 0) { endOfBodyPosition = BUFFER_HEADER_SPACE + DataConstants.SIZE_INT; } buffer.setIndex(0, 0); buffer.writeInt(endOfBodyPosition); // The end of body position buffer.writerIndex(endOfBodyPosition - BUFFER_HEADER_SPACE + DataConstants.SIZE_INT); encodeHeadersAndProperties(buffer); validBuffer = true; return this; }
public ResetLimitWrappedActiveMQBuffer(final int limit, final ActiveMQBuffer buffer, final Message message) { // a wrapped inside a wrapper will increase the stack size. // we fixed this here due to some profiling testing this(limit, unwrap(buffer.byteBuf()).duplicate(), message); }
private void checkBuffer() throws ActiveMQException { if (writableBuffer == null) { long bodySize = this.largeMessageSize + BODY_OFFSET; if (bodySize > Integer.MAX_VALUE) { bodySize = Integer.MAX_VALUE; } initBuffer((int) bodySize); writableBuffer = new ResetLimitWrappedActiveMQBuffer(BODY_OFFSET, buffer.duplicate(), this); largeMessageController.saveBuffer(new ActiveMQOutputStream(writableBuffer)); } }
public synchronized CoreMessage encode() { getProperties(); if (writableBuffer != null) { // The message encode takes into consideration the PacketImpl which is not part of this encoding // so we always need to take the BUFFER_HEADER_SPACE from packet impl into consideration endOfBodyPosition = writableBuffer.writerIndex() + BUFFER_HEADER_SPACE - 4; } else if (endOfBodyPosition <= 0) { endOfBodyPosition = BUFFER_HEADER_SPACE + DataConstants.SIZE_INT; } buffer.setIndex(0, 0); buffer.writeInt(endOfBodyPosition); // The end of body position buffer.writerIndex(endOfBodyPosition - BUFFER_HEADER_SPACE + DataConstants.SIZE_INT); encodeHeadersAndProperties(buffer); validBuffer = true; return this; }
@Override public void resetWriterIndex() { changed(); buffer.writerIndex(limit); }
private void internalWritableBuffer() { if (writableBuffer == null) { writableBuffer = new ResetLimitWrappedActiveMQBuffer(BODY_OFFSET, buffer.duplicate(), this); if (endOfBodyPosition > 0) { writableBuffer.byteBuf().setIndex(BODY_OFFSET, endOfBodyPosition - BUFFER_HEADER_SPACE + BODY_OFFSET); writableBuffer.resetReaderIndex(); } } }
public ResetLimitWrappedActiveMQBuffer(final int limit, final ByteBuf buffer, final Message message) { // a wrapped inside a wrapper will increase the stack size. // we fixed this here due to some profiling testing super(buffer); this.limit = limit; if (writerIndex() < limit) { writerIndex(limit); } readerIndex(limit); this.message = message; }
public ResetLimitWrappedActiveMQBuffer(final int limit, final ActiveMQBuffer buffer, final Message message) { // a wrapped inside a wrapper will increase the stack size. // we fixed this here due to some profiling testing this(limit, unwrap(buffer.byteBuf()).duplicate(), message); }
private void checkBuffer() throws ActiveMQException { if (writableBuffer == null) { long bodySize = this.largeMessageSize + BODY_OFFSET; if (bodySize > Integer.MAX_VALUE) { bodySize = Integer.MAX_VALUE; } initBuffer((int) bodySize); writableBuffer = new ResetLimitWrappedActiveMQBuffer(BODY_OFFSET, buffer.duplicate(), this); largeMessageController.saveBuffer(new ActiveMQOutputStream(writableBuffer)); } }
public synchronized CoreMessage encode() { checkProperties(); if (writableBuffer != null) { // The message encode takes into consideration the PacketImpl which is not part of this encoding // so we always need to take the BUFFER_HEADER_SPACE from packet impl into consideration endOfBodyPosition = writableBuffer.writerIndex() + BUFFER_HEADER_SPACE - 4; } else if (endOfBodyPosition <= 0) { endOfBodyPosition = BUFFER_HEADER_SPACE + DataConstants.SIZE_INT; } buffer.setIndex(0, 0); buffer.writeInt(endOfBodyPosition); // The end of body position buffer.writerIndex(endOfBodyPosition - BUFFER_HEADER_SPACE + DataConstants.SIZE_INT); encodeHeadersAndProperties(buffer); validBuffer = true; return this; }
@Override public void writerIndex(int writerIndex) { changed(); if (writerIndex < limit) { writerIndex = limit; } buffer.writerIndex(writerIndex); }
private void internalWritableBuffer() { if (writableBuffer == null) { synchronized (this) { if (writableBuffer == null) { writableBuffer = new ResetLimitWrappedActiveMQBuffer(BODY_OFFSET, buffer.duplicate(), this); if (endOfBodyPosition > 0) { writableBuffer.byteBuf().setIndex(BODY_OFFSET, endOfBodyPosition - BUFFER_HEADER_SPACE + BODY_OFFSET); writableBuffer.resetReaderIndex(); } } } } }
public ResetLimitWrappedActiveMQBuffer(final int limit, final ByteBuf buffer, final Message message) { // a wrapped inside a wrapper will increase the stack size. // we fixed this here due to some profiling testing super(buffer); this.limit = limit; if (writerIndex() < limit) { writerIndex(limit); } readerIndex(limit); this.message = message; }
public ResetLimitWrappedActiveMQBuffer(final int limit, final ActiveMQBuffer buffer, final Message message) { // a wrapped inside a wrapper will increase the stack size. // we fixed this here due to some profiling testing this(limit, unwrap(buffer.byteBuf()).duplicate(), message); }
private void checkBuffer() throws ActiveMQException { if (writableBuffer == null) { long bodySize = this.largeMessageSize + BODY_OFFSET; if (bodySize > Integer.MAX_VALUE) { bodySize = Integer.MAX_VALUE; } initBuffer((int) bodySize); writableBuffer = new ResetLimitWrappedActiveMQBuffer(BODY_OFFSET, buffer.duplicate(), this); largeMessageController.saveBuffer(new ActiveMQOutputStream(writableBuffer)); } }