@Test public void commitPublishesMessageByInvertingTheLengthValue() { final int index = 32; final int recordIndex = index - HEADER_LENGTH; when(buffer.getInt(lengthOffset(recordIndex))).thenReturn(-19); ringBuffer.commit(index); final InOrder inOrder = inOrder(buffer); inOrder.verify(buffer).getInt(lengthOffset(recordIndex)); inOrder.verify(buffer).putIntOrdered(lengthOffset(recordIndex), 19); inOrder.verifyNoMoreInteractions(); }
public void commit(final int index) { final int recordIndex = computeRecordIndex(index); final AtomicBuffer buffer = this.buffer; final int recordLength = verifyClaimedSpaceNotReleased(buffer, recordIndex); buffer.putIntOrdered(lengthOffset(recordIndex), -recordLength); }
OneToOneRingBuffer implements RingBuffer { public void commit(final int index) { final int recordIndex = computeRecordIndex(index); final AtomicBuffer buffer = this.buffer; final int recordLength = verifyClaimedSpaceNotReleased(buffer, recordIndex); buffer.putIntOrdered(lengthOffset(recordIndex), -recordLength); } }
OneToOneRingBuffer implements RingBuffer { public void commit(final int index) { final int recordIndex = computeRecordIndex(index); final AtomicBuffer buffer = this.buffer; final int recordLength = verifyClaimedSpaceNotReleased(buffer, recordIndex); buffer.putIntOrdered(lengthOffset(recordIndex), -recordLength); } OneToOneRingBuffer(final AtomicBuffer buffer); }
OneToOneRingBuffer implements RingBuffer { public void commit(final int index) { final int recordIndex = computeRecordIndex(index); final AtomicBuffer buffer = this.buffer; final int recordLength = verifyClaimedSpaceNotReleased(buffer, recordIndex); buffer.putIntOrdered(lengthOffset(recordIndex), -recordLength); } OneToOneRingBuffer(final AtomicBuffer buffer); int capacity(); boolean write(final int msgTypeId, final DirectBuffer srcBuffer, final int offset, final int length); int read(final MessageHandler handler); int read(final MessageHandler handler, final int messageCountLimit); int maxMsgLength(); long nextCorrelationId(); AtomicBuffer buffer(); void consumerHeartbeatTime(final long time); long consumerHeartbeatTime(); long producerPosition(); long consumerPosition(); int size(); boolean unblock(); int tryClaim(final int msgTypeId, final int length); void commit(final int index); void abort(final int index); }
OneToOneRingBuffer implements RingBuffer { public void commit(final int index) { final int recordIndex = computeRecordIndex(index); final AtomicBuffer buffer = this.buffer; final int recordLength = verifyClaimedSpaceNotReleased(buffer, recordIndex); buffer.putIntOrdered(lengthOffset(recordIndex), -recordLength); } OneToOneRingBuffer(final AtomicBuffer buffer); int capacity(); boolean write(final int msgTypeId, final DirectBuffer srcBuffer, final int offset, final int length); int read(final MessageHandler handler); int read(final MessageHandler handler, final int messageCountLimit); int maxMsgLength(); long nextCorrelationId(); AtomicBuffer buffer(); void consumerHeartbeatTime(final long time); long consumerHeartbeatTime(); long producerPosition(); long consumerPosition(); int size(); boolean unblock(); int tryClaim(final int msgTypeId, final int length); void commit(final int index); void abort(final int index);  }