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


Java OPartitionedDatabasePool.acquire方法代码示例

本文整理汇总了Java中com.orientechnologies.orient.core.db.OPartitionedDatabasePool.acquire方法的典型用法代码示例。如果您正苦于以下问题:Java OPartitionedDatabasePool.acquire方法的具体用法?Java OPartitionedDatabasePool.acquire怎么用?Java OPartitionedDatabasePool.acquire使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.orientechnologies.orient.core.db.OPartitionedDatabasePool的用法示例。


在下文中一共展示了OPartitionedDatabasePool.acquire方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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

示例3: 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

示例4: 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

示例5: Migrator1_2to1_3

import com.orientechnologies.orient.core.db.OPartitionedDatabasePool; //导入方法依赖的package包/类
public Migrator1_2to1_3(String srcPath) throws NdexException, SolrServerException, IOException {
	
	NetworkGlobalIndexManager mgr = new NetworkGlobalIndexManager();
	mgr.createCoreIfNotExists();
	
	srcDbPath = "plocal:" + srcPath;
	
	OGlobalConfiguration.USE_WAL.setValue(false);
	OGlobalConfiguration.WAL_SYNC_ON_PAGE_FLUSH.setValue(false);
	
	srcPool = new OPartitionedDatabasePool(srcDbPath , "admin","admin",5);

	srcConnection = srcPool.acquire();
	
	ODictionary srcDictionary = srcConnection.getDictionary();
	ODocument vd = (ODocument) srcDictionary.get("NdexSeq");
	seqId = vd.field("f1");
	
	Configuration configuration = Configuration.getInstance();
	targetDB = NdexDatabase.createNdexDatabase( configuration.getHostURI(),
			configuration.getDBURL(),
   			configuration.getDBUser(),
   			configuration.getDBPasswd(), 5);
	
	destConn = targetDB.getAConnection();
	
	graph = new OrientGraph(destConn,false);
	graph.setAutoScaleEdgeType(true);
	graph.setEdgeContainerEmbedded2TreeThreshold(40);
	graph.setUseLightweightEdges(true);
	
	networkDao = new BasicNetworkDAO ( destConn);
	
	dbDao = new NetworkDocDAO ( destConn);

}
 
开发者ID:ndexbio,项目名称:ndex-common,代码行数:37,代码来源:Migrator1_2to1_3.java


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