Search in sources :

Example 1 with CacheRecordManager

use of jdbm.recman.CacheRecordManager in project qi4j-sdk by Qi4j.

the class JdbmEntityStoreMixin method initialize.

private void initialize() throws IOException {
    String name = getDatabaseName();
    Properties properties = getProperties();
    recordManager = RecordManagerFactory.createRecordManager(name, properties);
    serializer = DefaultSerializer.INSTANCE;
    recordManager = new CacheRecordManager(recordManager, 1000, false);
    long recid = recordManager.getNamedObject("index");
    if (recid != 0) {
        index = BTree.load(recordManager, recid);
    } else {
        ByteArrayComparator comparator = new ByteArrayComparator();
        index = BTree.createInstance(recordManager, comparator, serializer, DefaultSerializer.INSTANCE, 16);
        recordManager.setNamedObject("index", index.getRecid());
    }
    recordManager.commit();
}
Also used : CacheRecordManager(jdbm.recman.CacheRecordManager) Properties(java.util.Properties) ByteArrayComparator(jdbm.helper.ByteArrayComparator)

Aggregations

Properties (java.util.Properties)1 ByteArrayComparator (jdbm.helper.ByteArrayComparator)1 CacheRecordManager (jdbm.recman.CacheRecordManager)1