本文整理汇总了Java中com.orientechnologies.orient.core.db.OPartitionedDatabasePool类的典型用法代码示例。如果您正苦于以下问题:Java OPartitionedDatabasePool类的具体用法?Java OPartitionedDatabasePool怎么用?Java OPartitionedDatabasePool使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OPartitionedDatabasePool类属于com.orientechnologies.orient.core.db包,在下文中一共展示了OPartitionedDatabasePool类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: OrientHttpSessionRepository
import com.orientechnologies.orient.core.db.OPartitionedDatabasePool; //导入依赖的package包/类
public OrientHttpSessionRepository(final OPartitionedDatabasePool pool,
final int sessionTimeout) {
this.pool = pool;
this.sessionTimeout = sessionTimeout;
try (final OObjectDatabaseTx db = new OObjectDatabaseTx(pool.acquire())) {
db.setAutomaticSchemaGeneration(true);
db.getEntityManager().registerEntityClass(OrientHttpSession.class);
db.getMetadata().getSchema().synchronizeSchema();
final OClass sessionClass = db.getMetadata().getSchema().getClass(OrientHttpSession.class);
createIndex(sessionClass, SESSION_ID_PROPERTY, UNIQUE_HASH_INDEX);
createIndex(sessionClass, LAST_ACCESSED_TIME_PROPERTY, NOTUNIQUE);
createIndex(sessionClass, MAX_INACTIVE_INTERVAL_IN_SECONDS_PROPERTY, NOTUNIQUE);
}
}
示例2: createDatabasePools
import com.orientechnologies.orient.core.db.OPartitionedDatabasePool; //导入依赖的package包/类
private void createDatabasePools() {
final ImmutableMap.Builder<String, OPartitionedDatabasePool> oPartitionedDatabasePoolMapBuilder = ImmutableMap.builder();
final ImmutableMap.Builder<String, ODatabaseDocumentTxSupplier> oDatabaseDocumentTxSupplierMapBuilder = ImmutableMap.builder();
databasePoolConfigs.stream().forEach(poolConfig -> {
try {
final OPartitionedDatabasePool pool = poolConfig.createDatabasePool();
oPartitionedDatabasePoolMapBuilder.put(poolConfig.getDatabaseName(), pool);
oDatabaseDocumentTxSupplierMapBuilder.put(poolConfig.getDatabaseName(), createODatabaseDocumentTxSupplier(poolConfig, pool));
log.logp(INFO, getClass().getName(), "createDatabasePools", () -> String.format("Created database pool for: %s", poolConfig));
} catch (final Exception e) {
log.logp(SEVERE, getClass().getName(), "createDatabasePools", e, () -> String.format("failed to create database pool for: %s", poolConfig));
}
});
this.databasePools = oPartitionedDatabasePoolMapBuilder.build();
this.oDatabaseDocumentTxSuppliers = oDatabaseDocumentTxSupplierMapBuilder.build();
}
示例3: jndiLookup
import com.orientechnologies.orient.core.db.OPartitionedDatabasePool; //导入依赖的package包/类
@Test
public void jndiLookup() throws Exception {
Object value = iniCtx.lookup("java:jboss/orientdb/test");
if (value == null) {
dumpJndi("java:jboss/orientdb/test");
}
assertTrue(value instanceof OPartitionedDatabasePool);
}
示例4: initObjectDatabaseTx
import com.orientechnologies.orient.core.db.OPartitionedDatabasePool; //导入依赖的package包/类
private void initObjectDatabaseTx(String database)
{
// OPartitionedDatabasePoolFactory poolFactory = new OPartitionedDatabasePoolFactory(30);
// OPartitionedDatabasePool pool = poolFactory.get(dbUrl, "admin", "admin");
logger.info("db url : {}{}", dbUrl, database);
if (dbUrl.startsWith("remote"))
{
OServerAdmin serverAdmin;
try
{
serverAdmin = new OServerAdmin(dbUrl + database).connect("admin", "admin");
if (!serverAdmin.existsDatabase())
{
serverAdmin.createDatabase(database, "object", "plocal");
}
}
catch (IOException e)
{
logger.info(e);
}
}
partitionedDatabasePool = new OPartitionedDatabasePool(dbUrl + database, "admin", "admin", 32, 10);
partitionedDatabasePool.setAutoCreate(true);
}
示例5: destroy
import com.orientechnologies.orient.core.db.OPartitionedDatabasePool; //导入依赖的package包/类
@AfterClass
public static void destroy()
{
OPartitionedDatabasePool partitionedDatabasePool = repositorySource.getPartitionedDatabasePool();
assertThat(partitionedDatabasePool.getAvailableConnections(), is(partitionedDatabasePool.getCreatedInstances()));
}
示例6: db
import com.orientechnologies.orient.core.db.OPartitionedDatabasePool; //导入依赖的package包/类
@Bean
public OPartitionedDatabasePool db(@Value("${session.db.url}") final String dbUrl,
@Value("${session.db.username}") final String username,
@Value("${session.db.password}") final String password) {
try {
new OObjectDatabaseTx(dbUrl).create();
} catch (OStorageExistsException ex) {
// database already exists. drop it and create another one.
new OObjectDatabaseTx(dbUrl).open(username, password).drop();
new OObjectDatabaseTx(dbUrl).create().close();
}
return new OPartitionedDatabasePool(dbUrl, username, password);
}
示例7: createPool
import com.orientechnologies.orient.core.db.OPartitionedDatabasePool; //导入依赖的package包/类
private DatabasePoolImpl createPool(final String name) {
// TODO: refine more control over how pool settings are configured per-database or globally
String uri = connectionUri(name);
OPartitionedDatabasePool underlying = new OPartitionedDatabasePool(uri, SYSTEM_USER, SYSTEM_PASSWORD, //
25, // max connections per partition
25); // max connections in the pool
// TODO: Do not allow shared pool() to be closed by users, only by ourselves
DatabasePoolImpl pool = new DatabasePoolImpl(underlying, name);
Lifecycles.start(pool);
return pool;
}
示例8: createODatabaseDocumentTxSupplier
import com.orientechnologies.orient.core.db.OPartitionedDatabasePool; //导入依赖的package包/类
private ODatabaseDocumentTxSupplier createODatabaseDocumentTxSupplier(final OrientDBPoolConfig poolConfig, final OPartitionedDatabasePool pool) {
if (CollectionUtils.isNotEmpty(poolConfig.getHooks())) {
return () -> {
final ODatabaseDocumentTx db = pool.acquire();
poolConfig.getHooks().stream().forEach(hook -> db.registerHook(hook.get()));
return db;
};
} else {
return () -> pool.acquire();
}
}
示例9: OrientDbDocServiceImpl
import com.orientechnologies.orient.core.db.OPartitionedDatabasePool; //导入依赖的package包/类
OrientDbDocServiceImpl(OrientDbDocumentCommand repoCmd, BundleContext context){
pool = new OPartitionedDatabasePool(repoCmd.getConf().getUrl(),
repoCmd.getConf().getUser(),
repoCmd.getConf().getPass(),
repoCmd.getConf().getPoolMax());
this.repoCmd = repoCmd;
}
示例10: ContentStore
import com.orientechnologies.orient.core.db.OPartitionedDatabasePool; //导入依赖的package包/类
public ContentStore(final String type, String name) {
startupIfEnginesAreMissing();
OPartitionedDatabasePool pool = new OPartitionedDatabasePoolFactory().get(type+":"+name, "admin", "admin");
pool.setAutoCreate(true);
db = pool.acquire();
ODatabaseRecordThreadLocal.INSTANCE.set(db);
updateSchema();
}
示例11: NdexDatabase
import com.orientechnologies.orient.core.db.OPartitionedDatabasePool; //导入依赖的package包/类
private NdexDatabase(String HostURI, String dbURL, String dbUserName,
String dbPassword, int size) throws NdexException {
// check if the db exists, if not create it.
try ( ODatabaseDocumentTx odb = new ODatabaseDocumentTx(dbURL)) {
if ( !odb.exists() )
odb.create();
}
Arrays.sort(NdexSupportedAspects) ;
pool = new OPartitionedDatabasePool(dbURL, dbUserName, dbPassword,size);
logger.info("Connection pool to " + dbUserName + "@" + dbURL + " ("+ size + ") created.");
ndexDatabase = pool.acquire();
dictionary = ndexDatabase.getDictionary();
NdexSchemaManager.INSTANCE.init(ndexDatabase);
vdoc = (ODocument) dictionary.get(sequenceKey);
if (vdoc == null ) {
ndexDatabase.commit();
internalCounterBase = 1;
vdoc = new ODocument(seqField, internalCounterBase); // + blockSize); // ids start with 1.
vdoc = vdoc.save();
dictionary.put(sequenceKey, vdoc);
ndexDatabase.commit();
}
batchCounter=blockSize;
URIPrefix = HostURI;
}
示例12: getDatabasePool
import com.orientechnologies.orient.core.db.OPartitionedDatabasePool; //导入依赖的package包/类
private OPartitionedDatabasePool getDatabasePool() throws NamingException {
return (OPartitionedDatabasePool) initialContext.lookup(DATABASE_JNDI);
}
示例13: getPartitionedDatabasePool
import com.orientechnologies.orient.core.db.OPartitionedDatabasePool; //导入依赖的package包/类
public OPartitionedDatabasePool getPartitionedDatabasePool()
{
return partitionedDatabasePool;
}
示例14: DatabaseInfo
import com.orientechnologies.orient.core.db.OPartitionedDatabasePool; //导入依赖的package包/类
DatabaseInfo(final OPartitionedDatabasePool databasePool)
{
this.databasePool = databasePool;
}
示例15: TestPeopleDao
import com.orientechnologies.orient.core.db.OPartitionedDatabasePool; //导入依赖的package包/类
public TestPeopleDao(OPartitionedDatabasePool databasePool) {
this.databasePool = databasePool;
}