@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; }
@Override public boolean loadExisting() { this.data = DBMaker.newFileDB(new File(dir.getLocation() + "/transit_schedule")).transactionDisable().mmapFileEnable().readOnly().make(); init(); for (String gtfsFeedId : this.gtfsFeedIds) { GTFSFeed feed = new GTFSFeed(new File(dir.getLocation() + "/" + gtfsFeedId)); this.gtfsFeeds.put(gtfsFeedId, feed); this.transfers.put(gtfsFeedId, new Transfers(feed)); } return true; }
.strictDBGet() .asyncWriteEnable() .mmapFileEnable() .commitFileSyncDisable() .cacheSize(config.getNumBufferedEntries())
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(); }
@Provides @Singleton DB getMaker() { File dbLocation = new File(configuration.getLocation(), "SciGraphIdMap"); return DBMaker.newFileDB(dbLocation).closeOnJvmShutdown().transactionDisable().mmapFileEnable() .make(); }
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(); }