コード例 #1
0
  /** Preload all dup DBs to be converted. */
  private void preloadAllDatabases() {

    final ArrayList<DatabaseImpl> dbsToConvert = new ArrayList<DatabaseImpl>();
    try {
      for (DatabaseId dbId : dbTree.getDbNamesAndIds().keySet()) {
        final DatabaseImpl dbImpl = dbTree.getDb(dbId);
        boolean releaseDbImpl = true;
        try {
          if (!needsConversion(dbImpl)) {
            continue;
          }
          dbsToConvert.add(dbImpl);
          releaseDbImpl = false;
        } finally {
          if (releaseDbImpl) {
            dbTree.releaseDb(dbImpl);
          }
        }
      }

      if (dbsToConvert.size() == 0) {
        return;
      }

      final DatabaseImpl[] dbArray = new DatabaseImpl[dbsToConvert.size()];
      dbsToConvert.toArray(dbArray);

      envImpl.preload(dbArray, preloadConfig);
    } finally {
      for (DatabaseImpl dbImpl : dbsToConvert) {
        dbTree.releaseDb(dbImpl);
      }
    }
  }
コード例 #2
0
  /** Converts all dup DBs that need conversion. */
  public void convertDatabases() {
    if (DEBUG) {
      System.out.println("DupConvert.convertDatabases");
    }
    if (preloadAll) {
      preloadAllDatabases();
    }
    for (DatabaseId dbId : dbTree.getDbNamesAndIds().keySet()) {
      final DatabaseImpl dbImpl = dbTree.getDb(dbId);
      try {
        if (!needsConversion(dbImpl)) {
          continue;
        }
        convertDatabase(dbImpl);
      } finally {
        dbTree.releaseDb(dbImpl);
      }
    }

    assert noDupNodesPresent();
  }
コード例 #3
0
  /**
   * Get a database object given a database name.
   *
   * @param databaseName target database.
   * @return null if database doesn't exist.
   */
  public DatabaseImpl getDb(Locker locker, String databaseName, Database databaseHandle)
      throws DatabaseException {

    return dbMapTree.getDb(locker, databaseName, databaseHandle);
  }