@Override public GraphExtension create(long byteCount) { final File file = new File(dir.getLocation() + "/transit_schedule"); try { Files.deleteIfExists(file.toPath()); } catch (IOException e) { throw new RuntimeException(e); } this.data = DBMaker.newFileDB(file).transactionDisable().mmapFileEnable().asyncWriteEnable().make(); init(); return this; }
.deleteFilesAfterClose() .strictDBGet() .asyncWriteEnable() .mmapFileEnable() .commitFileSyncDisable()
private static DB constructDB(File file) { return DBMaker.newFileDB(file) .transactionDisable() .mmapFileEnable() .asyncWriteEnable() .compressionEnable() .make(); }
/** Create a GTFS feed in a temp file */ public GTFSFeed () { // calls to this must be first operation in constructor - why, Java? this(DBMaker.newTempFileDB() .transactionDisable() .mmapFileEnable() .asyncWriteEnable() .deleteFilesAfterClose() .compressionEnable() // .cacheSize(1024 * 1024) this bloats memory consumption .make()); // TODO db.close(); }
.closeOnJvmShutdown() .cacheSize(24) .asyncWriteEnable() .make();
@Override public DBMaker<?> configure(DBMaker<?> maker) { return maker.asyncWriteEnable(); } };
@Override public DBMaker<?> configure(DBMaker<?> maker) { return maker.asyncWriteEnable(); } };
@Override public DBMaker<?> configure(DBMaker<?> maker) { return maker.asyncWriteEnable(); } };
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"); }
@Activate public void activate() { timer = new Timer(); File dbFolderPath = new File(DATABASE_ROOT); Path dbPath = dbFolderPath.toPath().resolve(DATABASE_PATH); log.debug("dbPath: {}", dbPath); //Make sure the directory exists, if it does not, make it. if (!dbFolderPath.isDirectory()) { log.info("The specified folder location for the database did not exist and will be created."); try { Files.createDirectories(dbFolderPath.toPath()); } catch (IOException e) { log.error("Could not create the required folder for the database."); throw new PersistenceException("Database folder could not be created."); } } //Notify if the database file does not exist. boolean dbFound = Files.exists(dbPath); if (!dbFound) { log.info("The database file could not be located, a new database will be constructed."); } else { log.info("A previous database file has been found."); } localDB = DBMaker.newFileDB(dbPath.toFile()) .asyncWriteEnable() .closeOnJvmShutdown() .make(); timer.schedule(commitTask, FLUSH_FREQUENCY_MILLIS, FLUSH_FREQUENCY_MILLIS); log.info("Started"); }
private MapDb() { try { File file = File.createTempFile("geo-analyzer", ".db"); db = DBMaker.newFileDB(file).asyncWriteEnable().cacheSize(100000) .closeOnJvmShutdown().transactionDisable().make(); } catch (IOException e) { throw new RuntimeException(e); } }
private static DB constructDB(String dbFile) { DB db; try{ DBMaker dbMaker = DBMaker.newFileDB(new File(dbFile)); db = dbMaker .transactionDisable() .mmapFileEnable() .asyncWriteEnable() .compressionEnable() // .cacheSize(1024 * 1024) this bloats memory consumption .make(); return db; } catch (ExecutionError | IOError | Exception e) { LOG.error("Could not construct db from file.", e); return null; } }
public LocalLinkSet() { this.db = DBMaker .newTempFileDB() .mmapFileEnable() .transactionDisable() .asyncWriteEnable() .asyncWriteFlushDelay(100) .make(); this.setMaker = db.createTreeSet("linkHashes"); long heapMaxSize = Runtime.getRuntime().maxMemory(); int presortMem = (int) Math.min(Integer.MAX_VALUE, Math.max(MIN_SORT_MEMORY, heapMaxSize / 20)); setMaker.pumpIgnoreDuplicates(); setMaker.pumpPresort(presortMem / LONG_MEMORY_BYTES); worker = new Thread() { @Override public void run() { setMaker.pumpSource(new LinkHashIterator()); set = setMaker.makeLongSet(); } }; worker.start(); }
public LocalLinkSet() { this.db = DBMaker .newTempFileDB() .mmapFileEnable() .transactionDisable() .asyncWriteEnable() .asyncWriteFlushDelay(100) .make(); this.setMaker = db.createTreeSet("linkHashes"); long heapMaxSize = Runtime.getRuntime().maxMemory(); int presortMem = (int) Math.min(Integer.MAX_VALUE, Math.max(MIN_SORT_MEMORY, heapMaxSize / 20)); setMaker.pumpIgnoreDuplicates(); setMaker.pumpPresort(presortMem / LONG_MEMORY_BYTES); worker = new Thread() { @Override public void run() { setMaker.pumpSource(new LinkHashIterator()); set = setMaker.makeLongSet(); } }; worker.start(); }
public KnownPhraseSim(String name, Language language, PhraseCreator creator, File dir, StringNormalizer stringNormalizer) throws IOException { this.name = name; this.language = language; this.creator = creator; this.stringNormalizer = stringNormalizer; this.dir = dir; this.dir.mkdirs(); this.phraseDb = DBMaker .newFileDB(new File(dir, "phrases.mapdb")) .mmapFileEnable() .transactionDisable() .asyncWriteEnable() .asyncWriteFlushDelay(100) .make(); this.db = phraseDb.getHashMap("phrases"); this.readPhrases(); this.readCosimilarity(); File f = new File(dir, "scoreNormalizer.bin"); if (f.isFile()) { scoreNormalizer = (Normalizer) WpIOUtils.readObjectFromFile(f); } }
/** Create a GTFS feed in a temp file */ public GTFSFeed () { // calls to this must be first operation in constructor - why, Java? this(DBMaker.newTempFileDB() .transactionDisable() .mmapFileEnable() .asyncWriteEnable() .deleteFilesAfterClose() .compressionEnable() // .cacheSize(1024 * 1024) this bloats memory consumption .make()); // TODO db.close(); }
dbMaker.asyncWriteEnable();
/** * Create a new DataStore. * @param directory Where should it be created? */ public JumperDataStore(File directory) { if(!directory.exists()) directory.mkdirs(); DBMaker dbm = DBMaker.newFileDB(new File(directory, "jumpers.db")) .mmapFileEnableIfSupported() .cacheLRUEnable() .cacheSize(100000) .asyncWriteEnable() .asyncWriteFlushDelay(1000) .closeOnJvmShutdown(); db = dbm.make(); jumperMap = db.createTreeMap("jumperMap") .valueSerializer(new JumperSerializer()) .makeOrGet(); jumperStartIndex = db.createTreeSet("startIndex") .serializer(BTreeKeySerializer.TUPLE2) .makeOrGet(); jumperEndIndex = db.createTreeSet("endIndex") .serializer(BTreeKeySerializer.TUPLE2) .makeOrGet(); }
maker = maker.cacheSize(cache_size); if (async) { maker = maker.asyncWriteEnable(); maker = maker.asyncWriteFlushDelay(10000);