コード例 #1
0
ファイル: NodeManager.java プロジェクト: sytanta/neo4j
 @Override
 public void start() {
   for (XaDataSource ds : xaDsm.getAllRegisteredDataSources()) {
     if (ds.getName().equals(Config.DEFAULT_DATA_SOURCE_NAME)) {
       // load and verify from PS
       NameData[] relTypes = null;
       NameData[] propertyIndexes = null;
       // beginTx();
       relTypes = persistenceManager.loadAllRelationshipTypes();
       propertyIndexes = persistenceManager.loadPropertyIndexes(INDEX_COUNT);
       // commitTx();
       addRawRelationshipTypes(relTypes);
       addPropertyIndexes(propertyIndexes);
       if (propertyIndexes.length < INDEX_COUNT) {
         setHasAllpropertyIndexes(true);
       }
     }
   }
 }
コード例 #2
0
  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;
  }