@Test public void shouldNotMigrateActiveTaskToOtherProcess() throws Exception { createClientWithPreviousActiveTasks(p1, 1, task00); createClientWithPreviousActiveTasks(p2, 1, task01); final StickyTaskAssignor firstAssignor = createTaskAssignor(task00, task01, task02); firstAssignor.assign(0); assertThat(clients.get(p1).activeTasks(), hasItems(task00)); assertThat(clients.get(p2).activeTasks(), hasItems(task01)); assertThat(allActiveTasks(), equalTo(Arrays.asList(task00, task01, task02))); clients.clear(); createClientWithPreviousActiveTasks(p1, 1, task01); createClientWithPreviousActiveTasks(p2, 1, task02); final StickyTaskAssignor secondAssignor = createTaskAssignor(task00, task01, task02); secondAssignor.assign(0); assertThat(clients.get(p1).activeTasks(), hasItems(task01)); assertThat(clients.get(p2).activeTasks(), hasItems(task02)); assertThat(allActiveTasks(), equalTo(Arrays.asList(task00, task01, task02))); }
@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);  }