use of com.orientechnologies.orient.core.db.OPartitionedDatabasePoolFactory in project orientdb by orientechnologies.
the class OServer method startupFromConfiguration.
public OServer startupFromConfiguration() throws IllegalArgumentException, SecurityException, InvocationTargetException, NoSuchMethodException, IOException {
OLogManager.instance().info(this, "OrientDB Server v" + OConstants.getVersion() + " is starting up...");
Orient.instance();
if (startupLatch == null)
startupLatch = new CountDownLatch(1);
if (shutdownLatch == null)
shutdownLatch = new CountDownLatch(1);
clientConnectionManager = new OClientConnectionManager(this);
initFromConfiguration();
if (OGlobalConfiguration.ENVIRONMENT_DUMP_CFG_AT_STARTUP.getValueAsBoolean()) {
System.out.println("Dumping environment after server startup...");
OGlobalConfiguration.dumpConfiguration(System.out);
}
dbPoolFactory = new OPartitionedDatabasePoolFactory();
dbPoolFactory.setMaxPoolSize(contextConfiguration.getValueAsInteger(OGlobalConfiguration.DB_POOL_MAX));
databaseDirectory = contextConfiguration.getValue("server.database.path", serverRootDirectory + "/databases/");
databaseDirectory = OFileUtils.getPath(OSystemVariableResolver.resolveSystemVariables(databaseDirectory));
databaseDirectory = databaseDirectory.replace("//", "/");
// CONVERT IT TO ABSOLUTE PATH
databaseDirectory = (new File(databaseDirectory)).getCanonicalPath();
databaseDirectory = OFileUtils.getPath(databaseDirectory);
if (!databaseDirectory.endsWith("/"))
databaseDirectory += "/";
OLogManager.instance().info(this, "Databases directory: " + new File(databaseDirectory).getAbsolutePath());
Orient.instance().getProfiler().registerHookValue("system.databases", "List of databases configured in Server", METRIC_TYPE.TEXT, new OProfilerHookValue() {
@Override
public Object getValue() {
final StringBuilder dbs = new StringBuilder(64);
for (String dbName : getAvailableStorageNames().keySet()) {
if (dbs.length() > 0)
dbs.append(',');
dbs.append(dbName);
}
return dbs.toString();
}
});
return this;
}
use of com.orientechnologies.orient.core.db.OPartitionedDatabasePoolFactory in project guice-persist-orient by xvik.
the class DocumentPool method start.
@Override
public void start(final String uri) {
this.uri = uri;
poolFactory = new OPartitionedDatabasePoolFactory();
poolFactory.setMaxPoolSize(OGlobalConfiguration.DB_POOL_MAX.getValueAsInteger());
// check database connection
new ODatabaseDocumentTx(uri).open(userManager.getUser(), userManager.getPassword()).close();
logger.debug("Pool {} started for '{}'", getType(), uri);
}
use of com.orientechnologies.orient.core.db.OPartitionedDatabasePoolFactory in project wicket-orientdb by OrienteerBAP.
the class TestStandaloneOrientDBCompatibility method testOrientDbLifeCycle.
public void testOrientDbLifeCycle(String dbURL, boolean createDb, boolean dropDb) throws Exception {
Orient.instance().startup();
assertNotNull(ODatabaseRecordThreadLocal.instance());
Orient.instance().removeShutdownHook();
OServer server = OServerMain.create();
server.startup(OrientDbTestWebApplication.class.getResource("db.config.xml").openStream());
server.activate();
if (createDb) {
ODatabaseDocument dbToCreate = new ODatabaseDocumentTx(dbURL);
if (!dbToCreate.exists())
dbToCreate.create();
dbToCreate.close();
}
assertNotNull(ODatabaseRecordThreadLocal.instance());
ODatabaseDocument db = new OPartitionedDatabasePoolFactory().get(dbURL, "admin", "admin").acquire();
db.close();
assertNotNull(ODatabaseRecordThreadLocal.instance());
if (dropDb) {
ODatabaseDocument dbToDrop = new ODatabaseDocumentTx(dbURL);
dbToDrop.open("admin", "admin");
dbToDrop.drop();
}
server.shutdown();
Orient.instance().shutdown();
// Thread.sleep(50);
}
Aggregations