本文整理汇总了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);
}
}
示例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();
}
}
示例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();
}
示例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;
}
示例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);
}