Skip to content

Commit

Permalink
[Java] Reorder TermGapFiller arguments to be in keeping with other lo…
Browse files Browse the repository at this point in the history
…ss processing methods.
  • Loading branch information
mjpt777 committed Jan 14, 2017
1 parent 0b2ee13 commit 962c93a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,17 @@ public class TermGapFiller
*
* @param logMetaDataBuffer containing the default headers
* @param termBuffer to gap fill
* @param termId for the current term.
* @param gapOffset to fill from
* @param gapLength to length of the gap.
* @param termId for the current term.
* @return true if the gap has been filled with a padding record or false if data found.
*/
public static boolean tryFillGap(
final UnsafeBuffer logMetaDataBuffer,
final UnsafeBuffer termBuffer,
final int termId,
final int gapOffset,
final int gapLength,
final int termId)
final int gapLength)
{
int offset = (gapOffset + gapLength) - FRAME_ALIGNMENT;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public void shouldFillGapAtBeginningOfTerm()
final int gapOffset = 0;
final int gapLength = 64;

assertTrue(TermGapFiller.tryFillGap(metaDataBuffer, termBuffer, gapOffset, gapLength, TERM_ID));
assertTrue(TermGapFiller.tryFillGap(metaDataBuffer, termBuffer, TERM_ID, gapOffset, gapLength));

assertThat(dataFlyweight.frameLength(), is(gapLength));
assertThat(dataFlyweight.termOffset(), is(gapOffset));
Expand All @@ -71,7 +71,7 @@ public void shouldNotOverwriteExistingFrame()

dataFlyweight.frameLength(32);

assertFalse(TermGapFiller.tryFillGap(metaDataBuffer, termBuffer, gapOffset, gapLength, TERM_ID));
assertFalse(TermGapFiller.tryFillGap(metaDataBuffer, termBuffer, TERM_ID, gapOffset, gapLength));
}

@Test
Expand All @@ -88,7 +88,7 @@ public void shouldFillGapAfterExistingFrame()
.frameLength(gapOffset);
dataFlyweight.setMemory(0, gapOffset - DataHeaderFlyweight.HEADER_LENGTH, (byte)'x');

assertTrue(TermGapFiller.tryFillGap(metaDataBuffer, termBuffer, gapOffset, gapLength, TERM_ID));
assertTrue(TermGapFiller.tryFillGap(metaDataBuffer, termBuffer, TERM_ID, gapOffset, gapLength));

dataFlyweight.wrap(termBuffer, gapOffset, termBuffer.capacity() - gapOffset);
assertThat(dataFlyweight.frameLength(), is(gapLength));
Expand Down Expand Up @@ -125,7 +125,7 @@ public void shouldFillGapBetweenExistingFrames()
.flags(UNFRAGMENTED)
.frameLength(64);

assertTrue(TermGapFiller.tryFillGap(metaDataBuffer, termBuffer, gapOffset, gapLength, TERM_ID));
assertTrue(TermGapFiller.tryFillGap(metaDataBuffer, termBuffer, TERM_ID, gapOffset, gapLength));

dataFlyweight.wrap(termBuffer, gapOffset, termBuffer.capacity() - gapOffset);
assertThat(dataFlyweight.frameLength(), is(gapLength));
Expand All @@ -150,7 +150,7 @@ public void shouldFillGapAtEndOfTerm()
.frameLength(termBuffer.capacity() - gapOffset);
dataFlyweight.setMemory(0, gapOffset - DataHeaderFlyweight.HEADER_LENGTH, (byte)'x');

assertTrue(TermGapFiller.tryFillGap(metaDataBuffer, termBuffer, gapOffset, gapLength, TERM_ID));
assertTrue(TermGapFiller.tryFillGap(metaDataBuffer, termBuffer, TERM_ID, gapOffset, gapLength));

dataFlyweight.wrap(termBuffer, gapOffset, termBuffer.capacity() - gapOffset);
assertThat(dataFlyweight.frameLength(), is(gapLength));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ int processPendingLoss()
else
{
final UnsafeBuffer termBuffer = termBuffers[indexByTerm(initialTermId, termId)];
if (tryFillGap(rawLog.logMetaData(), termBuffer, termOffset, length, termId))
if (tryFillGap(rawLog.logMetaData(), termBuffer, termId, termOffset, length))
{
lossGapFills.orderedIncrement();
}
Expand Down

0 comments on commit 962c93a

Please sign in to comment.