Skip to content

Commit

Permalink
Remove unnecessary ensureAvailable methods
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeb01 committed Apr 15, 2013
1 parent 6e91fa4 commit 9ce0fb1
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 36 deletions.
20 changes: 1 addition & 19 deletions src/main/java/com/lmax/disruptor/MultiProducerSequencer.java
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,7 @@ else if (cursor.compareAndSet(current, next))
@Override
public long tryNext() throws InsufficientCapacityException
{
int n = 1;
return tryNext(n);
return tryNext(1);
}

/**
Expand Down Expand Up @@ -249,23 +248,6 @@ private void setAvailableBufferValue(int index, int flag)
UNSAFE.putOrderedInt(availableBuffer, bufferAddress, flag);
}

/**
* @see Sequencer#ensureAvailable(long)
*/
@Override
public void ensureAvailable(long sequence)
{
int index = calculateIndex(sequence);
int flag = calculateAvailabilityFlag(sequence);
long bufferAddress = (index * SCALE) + BASE;

while (UNSAFE.getIntVolatile(availableBuffer, bufferAddress) != flag)
{
assert UNSAFE.getIntVolatile(availableBuffer, bufferAddress) <= flag;
// spin
}
}

/**
* @see Sequencer#isAvailable(long)
*/
Expand Down
9 changes: 0 additions & 9 deletions src/main/java/com/lmax/disruptor/Sequencer.java
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,6 @@ public interface Sequencer extends Cursored
*/
boolean isAvailable(long sequence);

/**
* Ensure a given sequence has been published and the event is now available.<p/>
*
* Blocks if the sequence is not available yet.
*
* @param sequence of the event to wait for
*/
void ensureAvailable(long sequence);

/**
* Add the specified gating sequences to this instance of the Disruptor. They will
* safely and atomically added to the list of gating sequences.
Expand Down
8 changes: 0 additions & 8 deletions src/main/java/com/lmax/disruptor/SingleProducerSequencer.java
Original file line number Diff line number Diff line change
Expand Up @@ -180,14 +180,6 @@ public void publish(long lo, long hi)
publish(hi);
}

/**
* @see Sequencer#ensureAvailable(long)
*/
@Override
public void ensureAvailable(long sequence)
{
}

/**
* @see Sequencer#isAvailable(long)
*/
Expand Down

0 comments on commit 9ce0fb1

Please sign in to comment.