Package org.mapdb

Examples of org.mapdb.DB.commit()


                    cacheFile.delete();
                }
            }
            this.cache = cache;
            this.data = this.cache.getHashMap(credentials == null ? "data" : "data-" + credentials.getId());
            cache.commit();
        } catch (SVNException e) {
            repository.closeSession();
            throw e;
        }
    }
View Full Code Here


        for(int i=0;i<1e4;i++){
            map1.put(i,"aaa"+i);
        }

        //commit first transaction
        tx1.commit();

        // !! IMPORTANT !!
        // !! DB transaction can be used only once,
        // !! it throws an 'already closed' exception after it was commited/rolledback
        // !! IMPORTANT !!
View Full Code Here

        // so far there was no conflict, since modified Map values lie far away from each other in tree.
        // `map2` has new key -10, so inserting -11 into map3 should update the same node
        map3.put(-11, "exists");
        // `map2` and `map3` now have conflicting data
        tx3.commit();
        System.out.println("Insert -11 into map3 was fine");

        //tx3 was commited, but tx2 now has conflicting data, so its commit will fail
        try{
            tx2.commit();
View Full Code Here

    dbMap.put("west",bilbo);
    dbMap.put("south",sauron);
    dbMap.put("mid",radagast);

    // Commit and close
    db.commit();
    db.close();


        //
        // Second option for using cystom values is to use your own serializer.
View Full Code Here

        Map<String,Person> map2 = db2.createHashMap("map").valueSerializer(serializer).make();

        map2.put("North", new Person("Yet another dwarf","Somewhere"));

        db2.commit();
        db2.close();


  }
View Full Code Here

        map.put(1,"one");
        map.put(2,"two");
        //map.keySet() is now [1,2] even before commit

        db.commit()//persist changes into disk

        map.put(3,"three");
        //map.keySet() is now [1,2,3]
        db.rollback(); //revert recent changes
        //map.keySet() is now [1,2]
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.