Details
Description
BlockSender.java
private static void waitForMinLength(ReplicaInPipeline rbw, long len) throws IOException { // Wait for 3 seconds for rbw replica to reach the minimum length for (int i = 0; i < 30 && rbw.getBytesOnDisk() < len; i++) { try { Thread.sleep(100); } catch (InterruptedException ie) { throw new IOException(ie); } } long bytesOnDisk = rbw.getBytesOnDisk(); if (bytesOnDisk < len) { throw new IOException( String.format("Need %d bytes, but only %d bytes available", len, bytesOnDisk)); } }
It is not very efficient to poll for status in this way. Instead, use notifyAll within the ReplicaInPipeline to notify the caller when the replica has reached a certain size.