Search in sources :

Example 1 with DBMaker

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();
    }
}
Also used : DBMaker(org.mapdb.DBMaker) IOException(java.io.IOException) File(java.io.File)

Example 2 with DBMaker

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();
}
Also used : DBMaker(org.mapdb.DBMaker) File(java.io.File)

Aggregations

File (java.io.File)2 DBMaker (org.mapdb.DBMaker)2 IOException (java.io.IOException)1