本文整理汇总了Java中org.mapdb.DBMaker.asyncWriteEnable方法的典型用法代码示例。如果您正苦于以下问题:Java DBMaker.asyncWriteEnable方法的具体用法?Java DBMaker.asyncWriteEnable怎么用?Java DBMaker.asyncWriteEnable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.mapdb.DBMaker
的用法示例。
在下文中一共展示了DBMaker.asyncWriteEnable方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fromConfiguration
import org.mapdb.DBMaker; //导入方法依赖的package包/类
public StorageService fromConfiguration(Map<String, String> configuration) throws StorageBackendException {
DBMaker dbMaker = createDBMakerInstance(configuration);
String enableMmapFileProperty = configuration.get(PROPERTY_KEY_MMAP);
String disableTransactionProperty = configuration.get(PROPERTY_KEY_DISABLE_TRANSACTIONS);
String enableAsyncWriteProperty = configuration.get(PROPERTY_KEY_ASYNC_WRITE);
if ("true".equals(enableMmapFileProperty)) {
LOGGER.info("Enabling memory mapped I/O");
dbMaker.mmapFileEnable();
}
if ("true".equals(disableTransactionProperty)) {
LOGGER.info("Disabling transactions");
dbMaker.transactionDisable();
}
if ("true".equals(enableAsyncWriteProperty)) {
LOGGER.info("Enabling asynchronous write operations");
dbMaker.asyncWriteEnable();
}
return new MapdbStorageEngine(dbMaker);
}
示例2: init
import org.mapdb.DBMaker; //导入方法依赖的package包/类
private void init() {
DBMaker maker;
if (file == null)
maker = DBMaker.newMemoryDB();
else {
if (overwrite)
wipe(file);
maker = DBMaker.newFileDB(new File(file));
maker = maker.cacheSize(cache_size);
if (async) {
maker = maker.asyncWriteEnable();
maker = maker.asyncWriteFlushDelay(10000);
}
if (mmap)
maker = maker.mmapFileEnableIfSupported();
if (compression)
maker = maker.compressionEnable();
if (snapshot)
maker = maker.snapshotEnable();
if (notxn)
maker = maker.transactionDisable();
}
db = maker.make();
if (!db.exists("idmap"))
idmap = db.createHashMap("idmap")
.valueSerializer(new RecordSerializer())
.make();
else
idmap = db.getHashMap("idmap");
}