RingBuffer { protected int getBufferSize() { return bufferSize; } RingBuffer( String name,
                Cursor cursor,
                Executor executor,
                ConsumerAdapter<T, C> consumerAdapter,
                boolean gcEntries,
                boolean singleProducer ); boolean add( T entry ); boolean add( T[] entries ); boolean addConsumer( final C consumer ); boolean addConsumer( final C consumer,
                                final int timesToRetryUponTimeout ); boolean remove( C consumer ); boolean hasConsumers(); void shutdown();  }
@Test @FixFor( "MODE-2195" ) public void shouldAutomaticallySetTheBufferSizeToTheNextPowerOf2() throws Exception { Executor executor = Executors.newCachedThreadPool(); RingBuffer<Long, Consumer<Long>> ringBuffer = RingBufferBuilder.withSingleProducer(executor, Long.class).ofSize(5) .garbageCollect(false).build(); assertEquals(8, ringBuffer.getBufferSize()); ringBuffer = RingBufferBuilder.withSingleProducer(executor, Long.class).ofSize(1023).garbageCollect(false).build(); assertEquals(1024, ringBuffer.getBufferSize()); }