public AutoscaleCore(final ConfigurationSource configSource, final ServiceSource serviceSource, final ServiceScaler serviceScaler, final Collection<WorkloadAnalyserFactoryProvider> workloadProviders, final ElectionFactory electionFactory, final ScheduledExecutorService scheduler, final ServicePath servicePath, final Collection<AlertDispatcherFactory> alertDispatcherFactories) throws ScalerException { if (workloadProviders.isEmpty()) { throw new ScalerException("No instances of WorkloadAnalyserFactory found"); } for (WorkloadAnalyserFactoryProvider provider : workloadProviders) { LOG.debug("Registering workload analyser: {}", provider.getWorkloadAnalyserName()); analyserFactoryMap.put(provider.getWorkloadAnalyserName(), provider.getWorkloadAnalyserFactory(configSource)); } for (final AlertDispatcherFactory factory : alertDispatcherFactories) { LOG.debug("Registering workload analyser: {}", factory.getAlertDispatcherName()); alertDispatcherMap.put(factory.getAlertDispatcherName(), factory.getAlertDispatcher(configSource)); } this.scaler = new ScalerDecorator(serviceScaler, false); this.scheduler = scheduler; this.source = serviceSource; ServiceValidator validator = new ServiceValidator(Collections.unmodifiableCollection(analyserFactoryMap.keySet())); this.autoscaleScheduler = new AutoscaleScheduler(Collections.unmodifiableMap(analyserFactoryMap), scaler, scheduler, validator, alertDispatcherMap, getConfiguration(configSource, ResourceMonitoringConfiguration.class), getConfiguration(configSource, AlertDispatchConfiguration.class)); this.election = electionFactory.getElection(servicePath.getGroup() + "-" + AUTOSCALE_SERVICE_NAME, new AutoscaleElectionCallback()); }