JobDispatcher implements JobInvokerRegister { @Override public synchronized void registerJobInvoker(final JobInvoker invoker) { ArgumentChecker.notNull(invoker, "invoker"); s_logger.debug("Registering job invoker {}", invoker); getInvokers().add(invoker); getCapabilityCache().put(invoker, invoker.getCapabilities()); if (!getPending().isEmpty()) { retryPending(0L); } } JobDispatcher();  JobDispatcher(final JobInvoker invoker);  JobDispatcher(final Collection<JobInvoker> invokers); int getMaxJobAttempts(); void setMaxJobAttempts(final int maxJobAttempts); void setJobFailureNodeId(final String jobFailureNodeId); String getJobFailureNodeId(); long getMaxJobExecutionTime(); FunctionBlacklistMaintainer getFunctionBlacklistMaintainer(); void setFunctionBlacklistMaintainer(final FunctionBlacklistMaintainer blacklistUpdate); synchronized void setMaxJobExecutionTime(final long maxJobExecutionTime); void setMaxJobExecutionTimeQuery(final long maxJobExecutionTimeQuery); long getMaxJobExecutionTimeQuery(); void setStatisticsGatherer(final CalculationNodeStatisticsGatherer statisticsGatherer); CalculationNodeStatisticsGatherer getStatisticsGatherer(); void setCapabilityRequirementsProvider(final CapabilityRequirementsProvider capabilityRequirementsProvider); CapabilityRequirementsProvider getCapabilityRequirementsProvider(); @Override synchronized void registerJobInvoker(final JobInvoker invoker); Cancelable dispatchJob(final CalculationJob job, final JobResultReceiver resultReceiver); Map<String, Collection<Capability>> getAllCapabilities();  }
@Test public void invokeInRoundRobinOrder() { s_logger.info("invokeInRoundRobinOrder"); final JobDispatcher jobDispatcher = new JobDispatcher(); final TestJobInvoker node1 = new TestJobInvoker("1"); final TestJobInvoker node2 = new TestJobInvoker("2"); final TestJobInvoker node3 = new TestJobInvoker("3"); jobDispatcher.registerJobInvoker(node1); jobDispatcher.registerJobInvoker(node2); jobDispatcher.registerJobInvoker(node3); nodeTest("1", jobDispatcher); assertNull(node1._callback); nodeTest("2", jobDispatcher); assertNull(node2._callback); nodeTest("3", jobDispatcher); assertNull(node3._callback); node1._disabled = true; nodeTest("2", jobDispatcher); assertNotNull(node1._callback); assertNull(node2._callback); }