/** 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); } } }
/** 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(); }