Package org.mapdb

Examples of org.mapdb.DBMaker


  @Override
  protected synchronized ConcurrentNavigableMap<TimeAndDims, Integer> createFactsTable()
  {
    if (factsDb == null) {
      final DBMaker dbMaker = DBMaker.newMemoryDirectDB()
                                     .transactionDisable()
                                     .asyncWriteEnable()
                                     .cacheSoftRefEnable();
      factsDb = dbMaker.make();
      db = dbMaker.make();
    }
    final TimeAndDimsSerializer timeAndDimsSerializer = new TimeAndDimsSerializer(this);
    return factsDb.createTreeMap("__facts" + UUID.randomUUID())
                  .keySerializer(timeAndDimsSerializer)
                  .comparator(timeAndDimsSerializer.getComparator())
View Full Code Here


    }
    return null;
  }

  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();
View Full Code Here

                                     .compressionEnable()
                                     .checksumEnable()
                                     .closeOnJvmShutdown()
                                     .snapshotEnable();
            */
            DBMaker dbMaker = DBMaker.newFileDB(new File(journalFileLocation, RECORDS_FIELD))
                                     .compressionEnable()
                                     .checksumEnable()
                                     .mmapFileEnableIfSupported()
                                     .snapshotEnable();
            if (asyncWritesEnabled) {
                dbMaker.asyncWriteEnable();
            }
            this.journalDB = dbMaker.make();
            this.records = this.journalDB.createTreeMap(RECORDS_FIELD).counterEnable().makeOrGet();
            Atomic.String journalAtomic = this.journalDB.getAtomicString(JOURNAL_ID_FIELD);
            //only write the value the first time
            if (StringUtil.isBlank(journalAtomic.get())) {
                journalAtomic.set("journal_" + UUID.randomUUID().toString());
View Full Code Here

TOP

Related Classes of org.mapdb.DBMaker

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.