/** * Set the instance definition -this also builds the (now obsolete) * cluster specification from it. * * Important: this is for early binding and must not be used after the build * operation is complete. * @param definition initial definition * @throws BadConfigException */ public synchronized void setInitialInstanceDefinition(AggregateConf definition) throws BadConfigException, IOException { log.debug("Setting initial instance definition"); // snapshot the definition AggregateConfSerDeser serDeser = new AggregateConfSerDeser(); unresolvedInstanceDefinition = serDeser.fromInstance(definition); this.instanceDefinition = serDeser.fromInstance(definition); onInstanceDefinitionUpdated(); }
/** * Set the instance definition -this also builds the (now obsolete) * cluster specification from it. * * Important: this is for early binding and must not be used after the build * operation is complete. * @param definition initial definition * @throws BadConfigException */ public synchronized void setInitialInstanceDefinition(AggregateConf definition) throws BadConfigException, IOException { log.debug("Setting initial instance definition"); // snapshot the definition AggregateConfSerDeser serDeser = new AggregateConfSerDeser(); unresolvedInstanceDefinition = serDeser.fromInstance(definition); this.instanceDefinition = serDeser.fromInstance(definition); onInstanceDefinitionUpdated(); }
/** * The resource configuration is updated -review and update state. * @param resources updated resources specification * @return a list of any dynamically added provider roles * (purely for testing purposes) */ @VisibleForTesting public synchronized List<ProviderRole> updateResourceDefinitions(ConfTree resources) throws BadConfigException, IOException { log.debug("Updating resources to {}", resources); // snapshot the (possibly unresolved) values ConfTreeSerDeser serDeser = new ConfTreeSerDeser(); unresolvedInstanceDefinition.setResources( serDeser.fromInstance(resources)); // assign another copy under the instance definition for resolving // and then driving application size instanceDefinition.setResources(serDeser.fromInstance(resources)); onInstanceDefinitionUpdated(); // propagate the role table Map<String, Map<String, String>> updated = resources.components; getClusterStatus().roles = SliderUtils.deepClone(updated); getClusterStatus().updateTime = now(); return buildRoleRequirementsFromResources(); }
/** * The resource configuration is updated -review and update state. * @param resources updated resources specification * @return a list of any dynamically added provider roles * (purely for testing purposes) */ @VisibleForTesting public synchronized List<ProviderRole> updateResourceDefinitions(ConfTree resources) throws BadConfigException, IOException { log.debug("Updating resources to {}", resources); // snapshot the (possibly unresolved) values ConfTreeSerDeser serDeser = new ConfTreeSerDeser(); unresolvedInstanceDefinition.setResources( serDeser.fromInstance(resources)); // assign another copy under the instance definition for resolving // and then driving application size instanceDefinition.setResources(serDeser.fromInstance(resources)); onInstanceDefinitionUpdated(); // propagate the role table Map<String, Map<String, String>> updated = resources.components; getClusterStatus().roles = SliderUtils.deepClone(updated); getClusterStatus().updateTime = now(); return buildRoleRequirementsFromResources(); }