Skip to content

Commit

Permalink
Make advanceCursor private for now.
Browse files Browse the repository at this point in the history
  • Loading branch information
abhishekrb19 committed Jul 26, 2024
1 parent 3c186a2 commit 52dc479
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,14 @@ private T peekNext()
int nextPosition = currentPosition < collection.size() ? currentPosition : 0;
return collection.get(nextPosition);
}
};
}

/**
* Advances the cursor position in the circular list. If the position reaches the end of the list, it wraps around.
*/
public void advanceCursor()
{
if (++currentPosition >= collection.size()) {
currentPosition = 0;
}
private void advanceCursor()
{
if (++currentPosition >= collection.size()) {
currentPosition = 0;
}
}
};
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,23 +66,6 @@ public void testIterateInReverseOrder()
Assert.assertEquals(ImmutableList.of(100, 0, -1, -4, 100, 0, -1, -4), observedElements);
}

@Test
public void testAdvanceCursor()
{
final Set<Integer> input = ImmutableSet.of(1, 10, 35, 50);
final CircularList<Integer> circularList = new CircularList<>(input, Comparator.naturalOrder());
final Iterator<Integer> iterator = circularList.iterator();

circularList.advanceCursor();
Assert.assertTrue(iterator.hasNext());
Assert.assertEquals((Integer) 10, iterator.next());

circularList.advanceCursor();
circularList.advanceCursor();
Assert.assertTrue(iterator.hasNext());
Assert.assertEquals((Integer) 1, iterator.next());
}

@Test
public void testEqualsSet()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,6 @@ private void killUnusedSegments(
++submittedTasks;
datasourceToLastKillIntervalEnd.put(dataSource, intervalToKill.getEnd());

// Check for termination conditions.
if (remainingDatasourcesToKill.isEmpty() || submittedTasks >= availableKillTaskSlots) {
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ public void testLowerMaxSegmentsToKill()
}

@Test
public void testDatasourcesFoundButNoUnusedSegments()
public void testKillDatasourceWithNoUnusedSegmentsInInitialRun()
{
configBuilder.withMaxSegmentsToKill(1);

Expand Down Expand Up @@ -643,10 +643,10 @@ public void testKillTaskSlotAtCapacity()

initDuty();
final CoordinatorRunStats stats = runDutyAndGetStats();

Assert.assertEquals(2, stats.get(Stats.Kill.AVAILABLE_SLOTS));
Assert.assertEquals(2, stats.get(Stats.Kill.SUBMITTED_TASKS));
Assert.assertEquals(2, stats.get(Stats.Kill.MAX_SLOTS));

Assert.assertEquals(2, stats.get(Stats.Kill.ELIGIBLE_UNUSED_SEGMENTS, DS1_STAT_KEY));
Assert.assertEquals(1, stats.get(Stats.Kill.ELIGIBLE_UNUSED_SEGMENTS, DS2_STAT_KEY));

Expand Down

0 comments on commit 52dc479

Please sign in to comment.