Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package examples;
 
 import org.mapdb.DB;
 import org.mapdb.Utils;
 
 import java.io.File;
 import java.util.Map;

Author(s):
Jan Kotek
public class Huge_Insert {
    public static void main(String[] args){
        DB db = DBMaker
                //.newFileDB(new File("/mnt/big/db/aa"))
                .newFileDB(new File("/mnt/big/db/aa" + System.currentTimeMillis()))
                .writeAheadLogDisable()
                .make();
        Map map = db
                .getTreeMap("map");
                //.getHashMap("map");
        long time = System.currentTimeMillis();
        long max = (int) 1e8;
        AtomicLong progress = new AtomicLong(0);
        Utils.printProgress(progress);
        while(progress.incrementAndGet()<max){
            Long val = ..nextLong();
            map.put(val"test"+val);
        }
        progress.set(-1);
        ..println("Closing");
        db.close();
        ..println(System.currentTimeMillis() - time);
    }
New to GrepCode? Check out our FAQ X