/** * Given specified <code>requiredCapacity</code> determines if that amount of space * is available. Note, you can not assume that if this method returns <code>true</code> * that a call to {@link RingBuffer#next()} will not block. Especially true if this * ring buffer is set up to handle multiple producers. * * @param requiredCapacity The capacity to check for. * @return <code>true</code> If the specified <code>requiredCapacity</code> is available * <code>false</code> if not. */ public boolean hasAvailableCapacity(int requiredCapacity) { return sequencer.hasAvailableCapacity(requiredCapacity); }
/** * Given specified <tt>requiredCapacity</tt> determines if that amount of space is available. Note, you can not assume that if this method returns * <tt>true</tt> that a call to {@link RingBuffer#next()} will not block. Especially true if this ring buffer is set up to handle multiple producers. * * @param requiredCapacity The capacity to check for. * @return <tt>true</tt> If the specified <tt>requiredCapacity</tt> is available <tt>false</tt> if now. */ public boolean hasAvailableCapacity(int requiredCapacity) { return sequencer.hasAvailableCapacity(requiredCapacity); }
@Test public void shouldIndicateHasAvailableCapacity() { sequencer.addGatingSequences(gatingSequence); assertTrue(sequencer.hasAvailableCapacity(1)); assertTrue(sequencer.hasAvailableCapacity(BUFFER_SIZE)); assertFalse(sequencer.hasAvailableCapacity(BUFFER_SIZE + 1)); sequencer.publish(sequencer.next()); assertTrue(sequencer.hasAvailableCapacity(BUFFER_SIZE - 1)); assertFalse(sequencer.hasAvailableCapacity(BUFFER_SIZE)); }
@Test public void shouldIndicateNoAvailableCapacity() { sequencer.addGatingSequences(gatingSequence); long sequence = sequencer.next(BUFFER_SIZE); sequencer.publish(sequence - (BUFFER_SIZE - 1), sequence); assertFalse(sequencer.hasAvailableCapacity(1)); }
/** * Given specified <tt>requiredCapacity</tt> determines if that amount of space * is available. Note, you can not assume that if this method returns <tt>true</tt> * that a call to {@link RingBuffer#next()} will not block. Especially true if this * ring buffer is set up to handle multiple producers. * * @param requiredCapacity The capacity to check for. * @return <tt>true</tt> If the specified <tt>requiredCapacity</tt> is available * <tt>false</tt> if not. */ public boolean hasAvailableCapacity(int requiredCapacity) { return sequencer.hasAvailableCapacity(requiredCapacity); }
/** * Given specified <tt>requiredCapacity</tt> determines if that amount of space * is available. Note, you can not assume that if this method returns <tt>true</tt> * that a call to {@link RingBuffer#next()} will not block. Especially true if this * ring buffer is set up to handle multiple producers. * * @param requiredCapacity The capacity to check for. * @return <tt>true</tt> If the specified <tt>requiredCapacity</tt> is available * <tt>false</tt> if not. */ public boolean hasAvailableCapacity(int requiredCapacity) { return sequencer.hasAvailableCapacity(requiredCapacity); }
/** * Given specified <tt>requiredCapacity</tt> determines if that amount of space * is available. Note, you can not assume that if this method returns <tt>true</tt> * that a call to {@link RingBuffer#next()} will not block. Especially true if this * ring buffer is set up to handle multiple producers. * * @param requiredCapacity The capacity to check for. * @return <tt>true</tt> If the specified <tt>requiredCapacity</tt> is available * <tt>false</tt> if now. */ public boolean hasAvailableCapacity(int requiredCapacity) { return sequencer.hasAvailableCapacity(requiredCapacity); }
/** * Given specified <tt>requiredCapacity</tt> determines if that amount of space * is available. Note, you can not assume that if this method returns <tt>true</tt> * that a call to {@link RingBuffer#next()} will not block. Especially true if this * ring buffer is set up to handle multiple producers. * * @param requiredCapacity The capacity to check for. * @return <tt>true</tt> If the specified <tt>requiredCapacity</tt> is available * <tt>false</tt> if now. */ public boolean hasAvailableCapacity(int requiredCapacity) { return sequencer.hasAvailableCapacity(requiredCapacity); }