Search in sources :

Example 1 with CacheType

use of org.neo4j.kernel.impl.core.NodeManager.CacheType in project neo4j-mobile-android by neo4j-contrib.

the class GraphDbModule method start.

public void start(LockReleaser lockReleaser, PersistenceManager persistenceManager, RelationshipTypeCreator relTypeCreator, Map<Object, Object> params) {
    if (!startIsOk) {
        return;
    }
    String cacheTypeName = (String) params.get(Config.CACHE_TYPE);
    CacheType cacheType = null;
    try {
        cacheType = cacheTypeName != null ? CacheType.valueOf(cacheTypeName) : DEFAULT_CACHE_TYPE;
    } catch (IllegalArgumentException e) {
        throw new IllegalArgumentException("Invalid cache type, please use one of: " + Arrays.asList(CacheType.values()) + " or keep empty for default (" + DEFAULT_CACHE_TYPE + ")", e.getCause());
    }
    if (!readOnly) {
        nodeManager = new NodeManager(graphDbService, cacheManager, lockManager, lockReleaser, transactionManager, persistenceManager, idGenerator, relTypeCreator, cacheType);
    } else {
        nodeManager = new ReadOnlyNodeManager(graphDbService, cacheManager, lockManager, lockReleaser, transactionManager, persistenceManager, idGenerator, cacheType);
    }
    // load and verify from PS
    RelationshipTypeData[] relTypes = null;
    PropertyIndexData[] propertyIndexes = null;
    // beginTx();
    relTypes = persistenceManager.loadAllRelationshipTypes();
    propertyIndexes = persistenceManager.loadPropertyIndexes(INDEX_COUNT);
    // commitTx();
    nodeManager.addRawRelationshipTypes(relTypes);
    nodeManager.addPropertyIndexes(propertyIndexes);
    if (propertyIndexes.length < INDEX_COUNT) {
        nodeManager.setHasAllpropertyIndexes(true);
    }
    nodeManager.start(params);
    startIsOk = false;
}
Also used : RelationshipTypeData(org.neo4j.kernel.impl.nioneo.store.RelationshipTypeData) PropertyIndexData(org.neo4j.kernel.impl.nioneo.store.PropertyIndexData) CacheType(org.neo4j.kernel.impl.core.NodeManager.CacheType)

Example 2 with CacheType

use of org.neo4j.kernel.impl.core.NodeManager.CacheType in project graphdb by neo4j-attic.

the class GraphDbModule method start.

public void start(LockReleaser lockReleaser, PersistenceManager persistenceManager, RelationshipTypeCreator relTypeCreator, Map<Object, Object> params) {
    if (!startIsOk) {
        return;
    }
    String cacheTypeName = (String) params.get(Config.CACHE_TYPE);
    CacheType cacheType = null;
    try {
        cacheType = cacheTypeName != null ? CacheType.valueOf(cacheTypeName) : DEFAULT_CACHE_TYPE;
    } catch (IllegalArgumentException e) {
        throw new IllegalArgumentException("Invalid cache type, please use one of: " + Arrays.asList(CacheType.values()) + " or keep empty for default (" + DEFAULT_CACHE_TYPE + ")", e.getCause());
    }
    if (!readOnly) {
        nodeManager = new NodeManager(graphDbService, cacheManager, lockManager, lockReleaser, transactionManager, persistenceManager, idGenerator, relTypeCreator, cacheType);
    } else {
        nodeManager = new ReadOnlyNodeManager(graphDbService, cacheManager, lockManager, lockReleaser, transactionManager, persistenceManager, idGenerator, cacheType);
    }
    // load and verify from PS
    RelationshipTypeData[] relTypes = null;
    PropertyIndexData[] propertyIndexes = null;
    // beginTx();
    relTypes = persistenceManager.loadAllRelationshipTypes();
    propertyIndexes = persistenceManager.loadPropertyIndexes(INDEX_COUNT);
    // commitTx();
    nodeManager.addRawRelationshipTypes(relTypes);
    nodeManager.addPropertyIndexes(propertyIndexes);
    if (propertyIndexes.length < INDEX_COUNT) {
        nodeManager.setHasAllpropertyIndexes(true);
    }
    nodeManager.start(params);
    startIsOk = false;
}
Also used : RelationshipTypeData(org.neo4j.kernel.impl.nioneo.store.RelationshipTypeData) PropertyIndexData(org.neo4j.kernel.impl.nioneo.store.PropertyIndexData) CacheType(org.neo4j.kernel.impl.core.NodeManager.CacheType)

Aggregations

CacheType (org.neo4j.kernel.impl.core.NodeManager.CacheType)2 PropertyIndexData (org.neo4j.kernel.impl.nioneo.store.PropertyIndexData)2 RelationshipTypeData (org.neo4j.kernel.impl.nioneo.store.RelationshipTypeData)2