use of com.orientechnologies.orient.core.db.ODatabaseRecordThreadLocal in project orientdb by orientechnologies.
the class OSystemDatabase method init.
private void init() {
final ODatabaseRecordThreadLocal tl = ODatabaseRecordThreadLocal.INSTANCE;
final ODatabaseDocumentInternal oldDbInThread = tl != null ? tl.getIfDefined() : null;
try {
ODatabaseDocumentTx sysDB = new ODatabaseDocumentTx("plocal:" + getSystemDatabasePath());
if (!sysDB.exists()) {
OLogManager.instance().info(this, "Creating the system database '%s' for current server", SYSTEM_DB_NAME);
Map<OGlobalConfiguration, Object> settings = new ConcurrentHashMap<OGlobalConfiguration, Object>();
settings.put(OGlobalConfiguration.CREATE_DEFAULT_USERS, false);
settings.put(OGlobalConfiguration.CLASS_MINIMUM_CLUSTERS, 1);
sysDB.create(settings);
sysDB.close();
}
} finally {
if (oldDbInThread != null) {
ODatabaseRecordThreadLocal.INSTANCE.set(oldDbInThread);
} else {
ODatabaseRecordThreadLocal.INSTANCE.remove();
}
}
}
Aggregations