当前位置: 首页>>代码示例>>Java>>正文


Java OPartitionedDatabasePool类代码示例

本文整理汇总了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);
  }
}
 
开发者ID:maseev,项目名称:spring-session-orientdb,代码行数:18,代码来源:OrientHttpSessionRepository.java

示例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();
}
 
开发者ID:runrightfast,项目名称:runrightfast-vertx,代码行数:18,代码来源:OrientDBPoolServiceImpl.java

示例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);
}
 
开发者ID:wildfly,项目名称:wildfly-nosql,代码行数:9,代码来源:CustomModuleTestCase.java

示例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);
}
 
开发者ID:geekflow,项目名称:light,代码行数:29,代码来源:RepositorySource.java

示例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()));
}
 
开发者ID:geekflow,项目名称:light,代码行数:8,代码来源:TransactionDaoTest.java

示例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);
}
 
开发者ID:maseev,项目名称:spring-session-orientdb,代码行数:15,代码来源:TestConfiguration.java

示例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;
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:14,代码来源:DatabaseManagerSupport.java

示例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();
    }
}
 
开发者ID:runrightfast,项目名称:runrightfast-vertx,代码行数:12,代码来源:OrientDBPoolServiceImpl.java

示例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;
}
 
开发者ID:wisdom-framework,项目名称:wisdom-orientdb,代码行数:9,代码来源:OrientDbDocServiceImpl.java

示例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();
}
 
开发者ID:jbake-org,项目名称:jbake,代码行数:10,代码来源:ContentStore.java

示例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;
	
}
 
开发者ID:ndexbio,项目名称:ndex-common,代码行数:34,代码来源:NdexDatabase.java

示例12: getDatabasePool

import com.orientechnologies.orient.core.db.OPartitionedDatabasePool; //导入依赖的package包/类
private OPartitionedDatabasePool getDatabasePool() throws NamingException {
    return (OPartitionedDatabasePool) initialContext.lookup(DATABASE_JNDI);
}
 
开发者ID:wildfly,项目名称:wildfly-nosql,代码行数:4,代码来源:AbstractTestCase.java

示例13: getPartitionedDatabasePool

import com.orientechnologies.orient.core.db.OPartitionedDatabasePool; //导入依赖的package包/类
public OPartitionedDatabasePool getPartitionedDatabasePool()
{
    return partitionedDatabasePool;
}
 
开发者ID:geekflow,项目名称:light,代码行数:5,代码来源:RepositorySource.java

示例14: DatabaseInfo

import com.orientechnologies.orient.core.db.OPartitionedDatabasePool; //导入依赖的package包/类
DatabaseInfo(final OPartitionedDatabasePool databasePool)
{
  this.databasePool = databasePool;
}
 
开发者ID:cstamas,项目名称:vertx-orientdb,代码行数:5,代码来源:ManagerImpl.java

示例15: TestPeopleDao

import com.orientechnologies.orient.core.db.OPartitionedDatabasePool; //导入依赖的package包/类
public TestPeopleDao(OPartitionedDatabasePool databasePool) {
    this.databasePool = databasePool;
}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:4,代码来源:TestPeopleDao.java


注:本文中的com.orientechnologies.orient.core.db.OPartitionedDatabasePool类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。