本文整理汇总了Java中com.sleepycat.je.DatabaseConfig.setExclusiveCreate方法的典型用法代码示例。如果您正苦于以下问题:Java DatabaseConfig.setExclusiveCreate方法的具体用法?Java DatabaseConfig.setExclusiveCreate怎么用?Java DatabaseConfig.setExclusiveCreate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sleepycat.je.DatabaseConfig
的用法示例。
在下文中一共展示了DatabaseConfig.setExclusiveCreate方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initEnvInternal
import com.sleepycat.je.DatabaseConfig; //导入方法依赖的package包/类
private void initEnvInternal(boolean create)
throws DatabaseException {
EnvironmentConfig envConfig = TestUtils.initEnvConfig();
envConfig.setTransactional(true);
envConfig.setAllowCreate(create);
envConfig.setConfigParam("je.nodeMaxEntries", "4");
envConfig.setConfigParam("je.nodeDupTreeMaxEntries", "4");
env = new Environment(envHome, envConfig);
DatabaseConfig dbConfig = new DatabaseConfig();
dbConfig.setAllowCreate(create);
dbConfig.setTransactional(true);
dbConfig.setExclusiveCreate(create);
db = env.openDatabase(null, "foo", dbConfig);
}
示例2: open
import com.sleepycat.je.DatabaseConfig; //导入方法依赖的package包/类
private void open()
throws Exception {
EnvironmentConfig envConfig = TestUtils.initEnvConfig();
envConfig.setConfigParam
(EnvironmentParams.NODE_MAX.getName(), String.valueOf(NODE_MAX));
envConfig.setAllowCreate(true);
env = new Environment(envHome, envConfig);
DatabaseConfig dbConfig = new DatabaseConfig();
dbConfig.setAllowCreate(true);
dbConfig.setExclusiveCreate(true);
dbConfig.setSortedDuplicates(dups);
db = env.openDatabase(null, "testDb", dbConfig);
}
示例3: open
import com.sleepycat.je.DatabaseConfig; //导入方法依赖的package包/类
private void open(boolean allowDuplicates)
throws Exception {
EnvironmentConfig envConfig = TestUtils.initEnvConfig();
envConfig.setConfigParam
(EnvironmentParams.NODE_MAX.getName(), String.valueOf(NODE_MAX));
/*
envConfig.setConfigParam
(EnvironmentParams.MAX_MEMORY.getName(), "10000000");
envConfig.setConfigParam
(EnvironmentParams.ENV_RUN_CLEANER.getName(), "false");
envConfig.setConfigParam
(EnvironmentParams.ENV_RUN_CHECKPOINTER.getName(), "false");
*/
envConfig.setConfigParam
(EnvironmentParams.ENV_RUN_EVICTOR.getName(), "false");
envConfig.setConfigParam
(EnvironmentParams.ENV_RUN_INCOMPRESSOR.getName(), "false");
envConfig.setTransactional(true);
envConfig.setAllowCreate(true);
env = new Environment(envHome, envConfig);
DatabaseConfig dbConfig = new DatabaseConfig();
dbConfig.setAllowCreate(true);
dbConfig.setExclusiveCreate(false);
dbConfig.setTransactional(true);
dbConfig.setSortedDuplicates(allowDuplicates);
db = env.openDatabase(null, "testDb", dbConfig);
}
示例4: keysIndex
import com.sleepycat.je.DatabaseConfig; //导入方法依赖的package包/类
/**
* Returns a read-only keys index that maps secondary key to primary key.
* When accessing the keys index, the primary key is returned rather than
* the entity. When only the primary key is needed and not the entire
* entity, using the keys index is less expensive than using the secondary
* index because the primary index does not have to be accessed.
*
* <p>Note the following in the unusual case that you are <em>not</em>
* using an <code>EntityStore</code>: This method will open the keys
* database, a second database handle for the secondary database, if it is
* not already open. In this case, if you are <em>not</em> using an
* <code>EntityStore</code>, then you are responsible for closing the
* database returned by {@link #getKeysDatabase} before closing the
* environment. If you <em>are</em> using an <code>EntityStore</code>, the
* keys database will be closed automatically by {@link
* EntityStore#close}.</p>
*
* @return the keys index.
*
* @throws DatabaseException the base class for all BDB exceptions.
*/
public synchronized EntityIndex<SK, PK> keysIndex()
throws DatabaseException {
if (keysIndex == null) {
if (keysDb == null) {
DatabaseConfig config = secDb.getConfig();
config.setReadOnly(true);
config.setAllowCreate(false);
config.setExclusiveCreate(false);
keysDb = DbCompat.openDatabase
(db.getEnvironment(), null /*txn*/,
DbCompat.getDatabaseFile(secDb),
secDb.getDatabaseName(),
config);
if (keysDb == null) {
throw new IllegalStateException
("Could not open existing DB, file: " +
DbCompat.getDatabaseFile(secDb) + " name: " +
secDb.getDatabaseName());
}
}
keysIndex = new KeysIndex<SK, PK>
(keysDb, keyClass, keyBinding,
priIndex.getKeyClass(), priIndex.getKeyBinding());
}
return keysIndex;
}
示例5: openDatabase
import com.sleepycat.je.DatabaseConfig; //导入方法依赖的package包/类
private Database openDatabase(final Environment env,
final boolean createNew) {
final DatabaseConfig dbConfig = new DatabaseConfig();
dbConfig.setTransactional(true);
dbConfig.setAllowCreate(createNew);
dbConfig.setExclusiveCreate(createNew);
dbConfig.setNodeMaxEntries(nodeMaxEntries);
dbConfig.setKeyPrefixing(keyPrefix > 0);
dbConfig.setSortedDuplicates(duplicates);
return env.openDatabase(null, "foo", dbConfig);
}