Search in sources :

Example 6 with EnvironmentMutableConfig

use of com.sleepycat.je.EnvironmentMutableConfig in project qpid-broker-j by apache.

the class StandardEnvironmentFacade method setCacheSize.

@Override
public void setCacheSize(long cacheSize) {
    Environment environment = getEnvironment();
    EnvironmentMutableConfig mutableConfig = environment.getMutableConfig();
    mutableConfig.setCacheSize(cacheSize);
    environment.setMutableConfig(mutableConfig);
}
Also used : EnvironmentMutableConfig(com.sleepycat.je.EnvironmentMutableConfig) Environment(com.sleepycat.je.Environment)

Example 7 with EnvironmentMutableConfig

use of com.sleepycat.je.EnvironmentMutableConfig 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);
            }
        }
    }
}
Also used : ConfigParam(com.sleepycat.je.config.ConfigParam) EnvironmentMutableConfig(com.sleepycat.je.EnvironmentMutableConfig) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map) TreeMap(java.util.TreeMap)

Aggregations

EnvironmentMutableConfig (com.sleepycat.je.EnvironmentMutableConfig)7 Environment (com.sleepycat.je.Environment)3 ConfigParam (com.sleepycat.je.config.ConfigParam)1 ReplicatedEnvironment (com.sleepycat.je.rep.ReplicatedEnvironment)1 LinkedHashMap (java.util.LinkedHashMap)1 Map (java.util.Map)1 TreeMap (java.util.TreeMap)1 ConnectionScopedRuntimeException (org.apache.qpid.server.util.ConnectionScopedRuntimeException)1 ServerScopedRuntimeException (org.apache.qpid.server.util.ServerScopedRuntimeException)1 VoldemortException (voldemort.VoldemortException)1 StorageInitializationException (voldemort.store.StorageInitializationException)1