use of org.mapdb.DBMaker in project sessdb by ppdai.
the class MdbBenchmark method open.
@Override
public void open() {
File file = new File(databaseDir_);
if (!file.exists()) {
file.mkdirs();
}
try {
File dbFile = File.createTempFile(DATABASE_NAME, "db", file);
DBMaker maker = DBMaker.newFileDB(dbFile).transactionDisable().asyncWriteQueueSize(5000).mmapFileEnableIfSupported();
if (this.getCompressMode()) {
maker.compressionEnable();
}
mdb_ = maker.make();
map_ = mdb_.createHashMap(MAP_NAME).hasher(Hasher.BYTE_ARRAY).makeOrGet();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
use of org.mapdb.DBMaker in project eol-globi-data by jhpoelen.
the class CacheService method initDb.
public DB initDb(String cacheName) throws PropertyEnricherException {
File mapdbCacheDir = new File(getCacheDir(), "mapdb");
createCacheDir(mapdbCacheDir, isTemporary());
DBMaker dbMaker = DBMaker.newFileDB(new File(mapdbCacheDir, cacheName)).mmapFileEnableIfSupported().closeOnJvmShutdown().transactionDisable();
if (isTemporary()) {
dbMaker.deleteFilesAfterClose();
}
return dbMaker.make();
}
Aggregations