@Test public void assertRemove() { when(regCenter.getDirectly("/state/ready/test_job_1")).thenReturn("1"); when(regCenter.getDirectly("/state/ready/test_job_2")).thenReturn("2"); readyService.remove(Arrays.asList("test_job_1", "test_job_2")); verify(regCenter).persist("/state/ready/test_job_2", "1"); verify(regCenter).remove("/state/ready/test_job_1"); verify(regCenter, times(0)).persist("/state/ready/test_job_1", "0"); verify(regCenter, times(0)).remove("/state/ready/test_job_2"); }
public void remove(final Collection<String> jobNames) { for (String each : jobNames) { String readyJobNode = ReadyNode.getReadyJobNodePath(each); String timesStr = regCenter.getDirectly(readyJobNode); int times = null == timesStr ? 0 : Integer.parseInt(timesStr); if (times <= 1) { regCenter.remove(readyJobNode); } else { regCenter.persist(readyJobNode, Integer.toString(times - 1)); } } }
ReadyService { public void remove(final Collection<String> jobNames) { for (String each : jobNames) { String readyJobNode = ReadyNode.getReadyJobNodePath(each); String timesStr = regCenter.getDirectly(readyJobNode); int times = null == timesStr ? 0 : Integer.parseInt(timesStr); if (times <= 1) { regCenter.remove(readyJobNode); } else { regCenter.persist(readyJobNode, Integer.toString(times - 1)); } } } }
ReadyService { public void remove(final Collection<String> jobNames) { for (String each : jobNames) { String readyJobNode = ReadyNode.getReadyJobNodePath(each); String timesStr = regCenter.getDirectly(readyJobNode); int times = null == timesStr ? 0 : Integer.parseInt(timesStr); if (times <= 1) { regCenter.remove(readyJobNode); } else { regCenter.persist(readyJobNode, Integer.toString(times - 1)); } } } ReadyService(final CoordinatorRegistryCenter regCenter); }
ReadyService { public void remove(final Collection<String> jobNames) { for (String each : jobNames) { String readyJobNode = ReadyNode.getReadyJobNodePath(each); String timesStr = regCenter.getDirectly(readyJobNode); int times = null == timesStr ? 0 : Integer.parseInt(timesStr); if (times <= 1) { regCenter.remove(readyJobNode); } else { regCenter.persist(readyJobNode, Integer.toString(times - 1)); } } } ReadyService(final CoordinatorRegistryCenter regCenter); void addTransient(final String jobName); void addDaemon(final String jobName); void setMisfireDisabled(final String jobName); Collection<JobContext> getAllEligibleJobContexts(final Collection<JobContext> ineligibleJobContexts); void remove(final Collection<String> jobNames); Map<String, Integer> getAllReadyTasks(); }
ReadyService { public void remove(final Collection<String> jobNames) { for (String each : jobNames) { String readyJobNode = ReadyNode.getReadyJobNodePath(each); String timesStr = regCenter.getDirectly(readyJobNode); int times = null == timesStr ? 0 : Integer.parseInt(timesStr); if (times <= 1) { regCenter.remove(readyJobNode); } else { regCenter.persist(readyJobNode, Integer.toString(times - 1)); } } } ReadyService(final CoordinatorRegistryCenter regCenter); void addTransient(final String jobName); void addDaemon(final String jobName); void setMisfireDisabled(final String jobName); Collection<JobContext> getAllEligibleJobContexts(final Collection<JobContext> ineligibleJobContexts); void remove(final Collection<String> jobNames); Map<String, Integer> getAllReadyTasks();  }