defaultTxnConfig.setReadCommitted(false);
break;
default:
throw new AssertionError();
}
EnvironmentConfig config = new EnvironmentConfig();
config.setAllowCreate(true);
config.setCacheSize(cacheSize);
config.setErrorHandler(new LoggingErrorHandler());
config.setInitializeCache(true);
config.setInitializeLocking(true);
config.setInitializeLogging(true);
config.setLockDetectMode(LockDetectMode.YOUNGEST);
config.setLockTimeout(lockTimeoutMicros);
config.setLogAutoRemove(removeLogs);
config.setMessageHandler(new LoggingMessageHandler());
config.setRunRecovery(true);
config.setTransactional(true);
config.setTxnWriteNoSync(!flushToDisk);
try {
env = new Environment(new File(directory), config);
} catch (FileNotFoundException e) {
throw new DbDatabaseException(
"DataStore directory does not exist: " + directory);