@Override public void updated(Dictionary properties) throws ConfigurationException { analyzeJobLoad = LoadUtil.getConfiguredLoadValue(properties, ANALYZE_JOB_LOAD_KEY, DEFAULT_ANALYZE_JOB_LOAD, serviceRegistry); normalizeJobLoad = LoadUtil.getConfiguredLoadValue(properties, NORMALIZE_JOB_LOAD_KEY, DEFAULT_NORMALIZE_JOB_LOAD, serviceRegistry); }
public static float getConfiguredLoadValue(@SuppressWarnings("rawtypes") Dictionary bundleProperties, String configKey, Float defaultValue, ServiceRegistry registry) { String jobLoad = StringUtils.trimToNull((String) bundleProperties.get(configKey)); float loadValue = defaultValue; if (jobLoad != null) { try { loadValue = Float.parseFloat(jobLoad); if (loadValue < 0) { logger.warn("Load value for key {} set to less than 0, defaulting to 0", configKey); loadValue = 0.0f; } logger.info("Set load for key {} to {}", configKey, loadValue); } catch (NumberFormatException e) { logger.warn("Can not set job loads to {}. {} must be a float", jobLoad, configKey); loadValue = defaultValue; logger.info("Set load for key {} to default of {}", configKey, loadValue); } } else { logger.info("No job load configuration found for key {}, load to default of {}", configKey, loadValue); } try { checkJobFitsCluster(loadValue, configKey, registry.getHostRegistrations()); } catch (ServiceRegistryException e) { logger.warn("Unable to verify that {} will run on this cluster due to load of {}", configKey, loadValue); } return loadValue; }
@Override @SuppressWarnings("rawtypes") public void updated(Dictionary properties) throws ConfigurationException { if (properties == null) return; inspectJobLoad = LoadUtil.getConfiguredLoadValue(properties, INSPECT_JOB_LOAD_KEY, DEFAULT_INSPECT_JOB_LOAD, serviceRegistry); enrichJobLoad = LoadUtil.getConfiguredLoadValue(properties, ENRICH_JOB_LOAD_KEY, DEFAULT_ENRICH_JOB_LOAD, serviceRegistry); }
@Override public void updated(Dictionary properties) throws ConfigurationException { if (properties == null) return; logger.debug("Start updating animate service"); synfigBinary = StringUtils.defaultIfBlank((String) properties.get(SYNFIG_BINARY_CONFIG), SYNFIG_BINARY_DEFAULT); logger.debug("Set synfig binary path to {}", synfigBinary); jobLoad = LoadUtil.getConfiguredLoadValue(properties, JOB_LOAD_CONFIG, JOB_LOAD_DEFAULT, serviceRegistry); logger.debug("Set animate job load to {}", jobLoad); logger.debug("Finished updating animate service"); }
waveformJobLoad = LoadUtil.getConfiguredLoadValue(properties, WAVEFORM_JOB_LOAD_CONFIG_KEY, DEFAULT_WAVEFORM_JOB_LOAD, serviceRegistry);
timelinepreviewsJobLoad = LoadUtil.getConfiguredLoadValue(properties, TIMELINEPREVIEWS_JOB_LOAD_KEY, DEFAULT_TIMELINEPREVIEWS_JOB_LOAD, serviceRegistry);