@Test public void shouldNotHaveSameAssignmentOnAnyTwoHostsWhenThereArePreviousActiveTasks() throws Exception { createClientWithPreviousActiveTasks(p1, 1, task01, task02); createClientWithPreviousActiveTasks(p2, 1, task03); createClientWithPreviousActiveTasks(p3, 1, task00); createClient(p4, 1); final StickyTaskAssignor<Integer> taskAssignor = createTaskAssignor(task00, task02, task01, task03); taskAssignor.assign(1); for (int i = p1; i <= p4; i++) { final Set<TaskId> taskIds = clients.get(i).assignedTasks(); for (int j = p1; j <= p4; j++) { if (j != i) { assertThat("clients shouldn't have same task assignment", clients.get(j).assignedTasks(), not(equalTo(taskIds))); } } } }
@Override public void assign(final int numStandbyReplicas) { assignActive(); assignStandby(numStandbyReplicas); }
StickyTaskAssignor implements TaskAssignor<ID, TaskId> { @Override public void assign(final int numStandbyReplicas) { assignActive(); assignStandby(numStandbyReplicas); } }
StickyTaskAssignor implements TaskAssignor<ID, TaskId> { @Override public void assign(final int numStandbyReplicas) { assignActive(); assignStandby(numStandbyReplicas); } StickyTaskAssignor(final Map<ID, ClientState> clients, final Set<TaskId> taskIds); }
StickyTaskAssignor implements TaskAssignor<ID, TaskId> { @Override public void assign(final int numStandbyReplicas) { assignActive(); assignStandby(numStandbyReplicas); } StickyTaskAssignor(final Map<ID, ClientState> clients, final Set<TaskId> taskIds); @Override void assign(final int numStandbyReplicas); }
StickyTaskAssignor implements TaskAssignor<ID, TaskId> { @Override public void assign(final int numStandbyReplicas) { assignActive(); assignStandby(numStandbyReplicas); } StickyTaskAssignor(final Map<ID, ClientState> clients, final Set<TaskId> taskIds); @Override void assign(final int numStandbyReplicas);  }