Java Code Examples for org.apache.hadoop.hdfs.protocol.Block#equals()

The following examples show how to use org.apache.hadoop.hdfs.protocol.Block#equals() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestUnderReplicatedBlockQueues.java    From hadoop with Apache License 2.0 5 votes vote down vote up
/**
 * Determine whether or not a block is in a level without changing the API.
 * Instead get the per-level iterator and run though it looking for a match.
 * If the block is not found, an assertion is thrown.
 *
 * This is inefficient, but this is only a test case.
 * @param queues queues to scan
 * @param block block to look for
 * @param level level to select
 */
private void assertInLevel(UnderReplicatedBlocks queues,
                           Block block,
                           int level) {
  UnderReplicatedBlocks.BlockIterator bi = queues.iterator(level);
  while (bi.hasNext()) {
    Block next = bi.next();
    if (block.equals(next)) {
      return;
    }
  }
  fail("Block " + block + " not found in level " + level);
}
 
Example 2
Source File: TestUnderReplicatedBlockQueues.java    From big-c with Apache License 2.0 5 votes vote down vote up
/**
 * Determine whether or not a block is in a level without changing the API.
 * Instead get the per-level iterator and run though it looking for a match.
 * If the block is not found, an assertion is thrown.
 *
 * This is inefficient, but this is only a test case.
 * @param queues queues to scan
 * @param block block to look for
 * @param level level to select
 */
private void assertInLevel(UnderReplicatedBlocks queues,
                           Block block,
                           int level) {
  UnderReplicatedBlocks.BlockIterator bi = queues.iterator(level);
  while (bi.hasNext()) {
    Block next = bi.next();
    if (block.equals(next)) {
      return;
    }
  }
  fail("Block " + block + " not found in level " + level);
}