@Test public void shouldReportCurrentTail() { final int tailValue = 64; when(metaDataBuffer.getIntVolatile(TERM_TAIL_COUNTER_OFFSET)).thenReturn(tailValue); assertThat(termAppender.tailVolatile(), is(tailValue)); }
/** * Get the current tail value in a volatile memory ordering fashion. If raw tail is greater than * term capacity then capacity will be returned. * * @return the current tail value. */ public int tailVolatile() { return Math.min(metaDataBuffer.getIntVolatile(TERM_TAIL_COUNTER_OFFSET), termBuffer.capacity()); }
/** * Get the raw value current tail value in a volatile memory ordering fashion. * * @return the current tail value. */ public int rawTailVolatile() { return metaDataBuffer.getIntVolatile(TERM_TAIL_COUNTER_OFFSET); }