Examples of CachedBlocksList


Examples of org.apache.hadoop.hdfs.server.blockmanagement.DatanodeDescriptor.CachedBlocksList

    }
  }

  private void processCacheReportImpl(final DatanodeDescriptor datanode,
      final List<Long> blockIds) {
    CachedBlocksList cached = datanode.getCached();
    cached.clear();
    CachedBlocksList cachedList = datanode.getCached();
    CachedBlocksList pendingCachedList = datanode.getPendingCached();
    for (Iterator<Long> iter = blockIds.iterator(); iter.hasNext(); ) {
      long blockId = iter.next();
      CachedBlock cachedBlock =
          new CachedBlock(blockId, (short)0, false);
      CachedBlock prevCachedBlock = cachedBlocks.get(cachedBlock);
      // Add the block ID from the cache report to the cachedBlocks map
      // if it's not already there.
      if (prevCachedBlock != null) {
        cachedBlock = prevCachedBlock;
      } else {
        cachedBlocks.put(cachedBlock);
      }
      // Add the block to the datanode's implicit cached block list
      // if it's not already there.  Similarly, remove it from the pending
      // cached block list if it exists there.
      if (!cachedBlock.isPresent(cachedList)) {
        cachedList.add(cachedBlock);
      }
      if (cachedBlock.isPresent(pendingCachedList)) {
        pendingCachedList.remove(cachedBlock);
      }
    }
  }
View Full Code Here

Examples of org.apache.hadoop.hdfs.server.blockmanagement.DatanodeDescriptor.CachedBlocksList

  /**
   * Return true if this CachedBlock is present on the given list.
   */
  public boolean isPresent(CachedBlocksList cachedBlocksList) {
    for (int i = 0; i < triplets.length; i += 3) {
      CachedBlocksList list = (CachedBlocksList)triplets[i];
      if (list == cachedBlocksList) {
        return true;
      }
    }
    return false;
View Full Code Here

Examples of org.apache.hadoop.hdfs.server.blockmanagement.DatanodeDescriptor.CachedBlocksList

   *                  alter the state of the CachedBlock.
   */
  public List<DatanodeDescriptor> getDatanodes(Type type) {
    List<DatanodeDescriptor> nodes = new LinkedList<DatanodeDescriptor>();
    for (int i = 0; i < triplets.length; i += 3) {
      CachedBlocksList list = (CachedBlocksList)triplets[i];
      if ((type == null) || (list.getType() == type)) {
        nodes.add(list.getDatanode());
      }
    }
    return nodes;
  }
View Full Code Here

Examples of org.apache.hadoop.hdfs.server.blockmanagement.DatanodeDescriptor.CachedBlocksList

        + ", processing time: " + (endTime - startTime) + " msecs");
  }

  private void processCacheReportImpl(final DatanodeDescriptor datanode,
      final List<Long> blockIds) {
    CachedBlocksList cached = datanode.getCached();
    cached.clear();
    CachedBlocksList cachedList = datanode.getCached();
    CachedBlocksList pendingCachedList = datanode.getPendingCached();
    for (Iterator<Long> iter = blockIds.iterator(); iter.hasNext(); ) {
      long blockId = iter.next();
      CachedBlock cachedBlock =
          new CachedBlock(blockId, (short)0, false);
      CachedBlock prevCachedBlock = cachedBlocks.get(cachedBlock);
      // Add the block ID from the cache report to the cachedBlocks map
      // if it's not already there.
      if (prevCachedBlock != null) {
        cachedBlock = prevCachedBlock;
      } else {
        cachedBlocks.put(cachedBlock);
      }
      // Add the block to the datanode's implicit cached block list
      // if it's not already there.  Similarly, remove it from the pending
      // cached block list if it exists there.
      if (!cachedBlock.isPresent(cachedList)) {
        cachedList.add(cachedBlock);
      }
      if (cachedBlock.isPresent(pendingCachedList)) {
        pendingCachedList.remove(cachedBlock);
      }
    }
  }
View Full Code Here

Examples of org.apache.hadoop.hdfs.server.blockmanagement.DatanodeDescriptor.CachedBlocksList

    }
  }

  private void processCacheReportImpl(final DatanodeDescriptor datanode,
      final List<Long> blockIds) {
    CachedBlocksList cached = datanode.getCached();
    cached.clear();
    CachedBlocksList cachedList = datanode.getCached();
    CachedBlocksList pendingCachedList = datanode.getPendingCached();
    for (Iterator<Long> iter = blockIds.iterator(); iter.hasNext(); ) {
      long blockId = iter.next();
      CachedBlock cachedBlock =
          new CachedBlock(blockId, (short)0, false);
      CachedBlock prevCachedBlock = cachedBlocks.get(cachedBlock);
      // Add the block ID from the cache report to the cachedBlocks map
      // if it's not already there.
      if (prevCachedBlock != null) {
        cachedBlock = prevCachedBlock;
      } else {
        cachedBlocks.put(cachedBlock);
      }
      // Add the block to the datanode's implicit cached block list
      // if it's not already there.  Similarly, remove it from the pending
      // cached block list if it exists there.
      if (!cachedBlock.isPresent(cachedList)) {
        cachedList.add(cachedBlock);
      }
      if (cachedBlock.isPresent(pendingCachedList)) {
        pendingCachedList.remove(cachedBlock);
      }
    }
  }
View Full Code Here

Examples of org.apache.hadoop.hdfs.server.blockmanagement.DatanodeDescriptor.CachedBlocksList

  /**
   * Return true if this CachedBlock is present on the given list.
   */
  public boolean isPresent(CachedBlocksList cachedBlocksList) {
    for (int i = 0; i < triplets.length; i += 3) {
      CachedBlocksList list = (CachedBlocksList)triplets[i];
      if (list == cachedBlocksList) {
        return true;
      }
    }
    return false;
View Full Code Here

Examples of org.apache.hadoop.hdfs.server.blockmanagement.DatanodeDescriptor.CachedBlocksList

   *                  alter the state of the CachedBlock.
   */
  public List<DatanodeDescriptor> getDatanodes(Type type) {
    List<DatanodeDescriptor> nodes = new LinkedList<DatanodeDescriptor>();
    for (int i = 0; i < triplets.length; i += 3) {
      CachedBlocksList list = (CachedBlocksList)triplets[i];
      if ((type == null) || (list.getType() == type)) {
        nodes.add(list.getDatanode());
      }
    }
    return nodes;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.