use of com.sleepycat.je.config.ConfigParam in project qpid-broker-j by apache.
the class EnvironmentUtils method updateMutableConfig.
public static void updateMutableConfig(Environment environment, Set<String> paramsSetByDefault, boolean includeHA, final ConfiguredObject<?> object) {
EnvironmentMutableConfig mutableConfig = environment.getMutableConfig();
final Set<String> contextVariables = object.getContextKeys(false);
for (Map.Entry<String, ConfigParam> entry : EnvironmentParams.SUPPORTED_PARAMS.entrySet()) {
String paramName = entry.getKey();
ConfigParam param = entry.getValue();
if (param.isMutable() && (includeHA || !param.isForReplication())) {
boolean contextValueSet = contextVariables.contains(paramName);
boolean currentlySetInEnv = mutableConfig.isConfigParamSet(paramName);
String contextValue = contextValueSet ? object.getContextValue(String.class, paramName) : null;
contextValueSet = (contextValue != null);
try {
if (contextValueSet) {
if (!currentlySetInEnv || !contextValue.equals(mutableConfig.getConfigParam(paramName))) {
mutableConfig.setConfigParam(paramName, contextValue);
LOGGER.debug("Setting BDB configuration parameter '{}' to value '{}'.", param, contextValue);
}
} else if (currentlySetInEnv && !paramsSetByDefault.contains(paramName)) {
mutableConfig.setConfigParam(paramName, param.getDefault());
LOGGER.debug("Setting BDB configuration parameter '{}' to its default value.", param);
}
} catch (IllegalArgumentException e) {
LOGGER.warn("Unable to set BDB configuration parameter '{}' to value '{}'.", param, contextValue, e);
}
}
}
}
Aggregations