本文整理匯總了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");
}