public static void waitReplication(FileSystem fs, Path fileName,
short replFactor) throws IOException {
boolean good;
do {
good = true;
BlockLocation locs[] = fs.getFileBlockLocations(
fs.getFileStatus(fileName), 0, Long.MAX_VALUE);
for (int j = 0; j < locs.length; j++) {
String[] loc = locs[j].getHosts();
if (loc.length != replFactor) {
System.out.println("File " + fileName + " has replication factor " +