/** * Get a list of the datanodes which this block is cached, * planned to be cached, or planned to be uncached on. * * @param type If null, this parameter is ignored. * If it is non-null, we match only datanodes which * have it on this list. * See {@link DatanodeDescriptor.CachedBlocksList.Type} * for a description of all the lists. * * @return The list of datanodes. Modifying this list does not * 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; }
/** * Get a list of the datanodes which this block is cached, * planned to be cached, or planned to be uncached on. * * @param type If null, this parameter is ignored. * If it is non-null, we match only datanodes which * have it on this list. * See {@link DatanodeDescriptor.CachedBlocksList.Type} * for a description of all the lists. * * @return The list of datanodes. Modifying this list does not * 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; }
/** * Get a list of the datanodes which this block is cached, * planned to be cached, or planned to be uncached on. * * @param type If null, this parameter is ignored. * If it is non-null, we match only datanodes which * have it on this list. * See {@link DatanodeDescriptor.CachedBlocksList.Type} * for a description of all the lists. * * @return The list of datanodes. Modifying this list does not * 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; }