private void scheduleOrReschedule(final ScalingConfiguration config, final WorkloadAnalyser analyser, final int initialDelay,
final Alerter alerter)
{
LOG.debug("Scheduling service {}", config.getId());
if ( scheduledServices.containsKey(config.getId()) ) {
cancel(config.getId());
}
governor.register(config);
ScheduledFuture future = scheduler.scheduleWithFixedDelay(new ScalerThread(governor, analyser, scaler, config.getId(),
config.getMinInstances(), config.getMaxInstances(),
config.getBackoffAmount(),
alerter,
resourceConfig),
initialDelay, config.getInterval(), TimeUnit.SECONDS);
scheduledServices.put(config.getId(), new ScheduledScalingService(config, future));
}