{
// See if the db cache size setting is valid.
if(cfg.getDBCacheSize() != 0)
{
if (MemoryBudget.getRuntimeMaxMemory() < cfg.getDBCacheSize()) {
throw new ConfigException(
ERR_CONFIG_JEB_CACHE_SIZE_GREATER_THAN_JVM_HEAP.get(
cfg.getDBCacheSize(), MemoryBudget.getRuntimeMaxMemory()));
}
if (cfg.getDBCacheSize() < MemoryBudget.MIN_MAX_MEMORY_SIZE) {
throw new ConfigException(
ERR_CONFIG_JEB_CACHE_SIZE_TOO_SMALL.get(
cfg.getDBCacheSize(), MemoryBudget.MIN_MAX_MEMORY_SIZE));
}
}
EnvironmentConfig envConfig = defaultConfig();
// Durability settings.
if (cfg.isDBTxnNoSync() && cfg.isDBTxnWriteNoSync())
{
throw new ConfigException(
ERR_CONFIG_JEB_DURABILITY_CONFLICT.get());
}
if (cfg.isDBTxnNoSync())
{
envConfig.setDurability(Durability.COMMIT_NO_SYNC);
}
if (cfg.isDBTxnWriteNoSync())
{
envConfig.setDurability(Durability.COMMIT_WRITE_NO_SYNC);
}
// Iterate through the config attributes associated with a JE property.
for (Map.Entry<String, String> mapEntry : attrMap.entrySet())
{
String jeProperty = mapEntry.getKey();
String attrName = mapEntry.getValue();
String value = getPropertyValue(cfg, attrName);
envConfig.setConfigParam(jeProperty, value);
}
// Set logging and file handler levels.
Logger parent = Logger.getLogger("com.sleepycat.je");
try
{
parent.setLevel(Level.parse(cfg.getDBLoggingLevel()));
}
catch (Exception e)
{
throw new ConfigException(
ERR_JEB_INVALID_LOGGING_LEVEL.get(
String.valueOf(cfg.getDBLoggingLevel()),
String.valueOf(cfg.dn())));
}
if (cfg.isDBLoggingFileHandlerOn())