Java 类org.apache.hadoop.hdfs.server.balancer.Dispatcher.Source 实例源码

项目:hadoop    文件:Balancer.java   
/**
 * For the given datanode, choose a candidate and then schedule it.
 * @return true if a candidate is chosen; false if no candidates is chosen.
 */
private <C extends StorageGroup> boolean choose4One(StorageGroup g,
    Collection<C> candidates, Matcher matcher) {
  final Iterator<C> i = candidates.iterator();
  final C chosen = chooseCandidate(g, i, matcher);

  if (chosen == null) {
    return false;
  }
  if (g instanceof Source) {
    matchSourceWithTargetToMove((Source)g, chosen);
  } else {
    matchSourceWithTargetToMove((Source)chosen, g);
  }
  if (!chosen.hasSpaceForScheduling()) {
    i.remove();
  }
  return true;
}
项目:aliyun-oss-hadoop-fs    文件:Balancer.java   
/**
 * For the given datanode, choose a candidate and then schedule it.
 * @return true if a candidate is chosen; false if no candidates is chosen.
 */
private <C extends StorageGroup> boolean choose4One(StorageGroup g,
    Collection<C> candidates, Matcher matcher) {
  final Iterator<C> i = candidates.iterator();
  final C chosen = chooseCandidate(g, i, matcher);

  if (chosen == null) {
    return false;
  }
  if (g instanceof Source) {
    matchSourceWithTargetToMove((Source)g, chosen);
  } else {
    matchSourceWithTargetToMove((Source)chosen, g);
  }
  if (!chosen.hasSpaceForScheduling()) {
    i.remove();
  }
  return true;
}
项目:big-c    文件:Balancer.java   
/**
 * For the given datanode, choose a candidate and then schedule it.
 * @return true if a candidate is chosen; false if no candidates is chosen.
 */
private <C extends StorageGroup> boolean choose4One(StorageGroup g,
    Collection<C> candidates, Matcher matcher) {
  final Iterator<C> i = candidates.iterator();
  final C chosen = chooseCandidate(g, i, matcher);

  if (chosen == null) {
    return false;
  }
  if (g instanceof Source) {
    matchSourceWithTargetToMove((Source)g, chosen);
  } else {
    matchSourceWithTargetToMove((Source)chosen, g);
  }
  if (!chosen.hasSpaceForScheduling()) {
    i.remove();
  }
  return true;
}
项目:hadoop-2.6.0-cdh5.4.3    文件:Balancer.java   
/**
 * For the given datanode, choose a candidate and then schedule it.
 * @return true if a candidate is chosen; false if no candidates is chosen.
 */
private <C extends StorageGroup> boolean choose4One(StorageGroup g,
    Collection<C> candidates, Matcher matcher) {
  final Iterator<C> i = candidates.iterator();
  final C chosen = chooseCandidate(g, i, matcher);

  if (chosen == null) {
    return false;
  }
  if (g instanceof Source) {
    matchSourceWithTargetToMove((Source)g, chosen);
  } else {
    matchSourceWithTargetToMove((Source)chosen, g);
  }
  if (!chosen.hasSpaceForScheduling()) {
    i.remove();
  }
  return true;
}
项目:FlexMap    文件:Balancer.java   
/**
 * For the given datanode, choose a candidate and then schedule it.
 * @return true if a candidate is chosen; false if no candidates is chosen.
 */
private <C extends StorageGroup> boolean choose4One(StorageGroup g,
    Collection<C> candidates, Matcher matcher) {
  final Iterator<C> i = candidates.iterator();
  final C chosen = chooseCandidate(g, i, matcher);

  if (chosen == null) {
    return false;
  }
  if (g instanceof Source) {
    matchSourceWithTargetToMove((Source)g, chosen);
  } else {
    matchSourceWithTargetToMove((Source)chosen, g);
  }
  if (!chosen.hasSpaceForScheduling()) {
    i.remove();
  }
  return true;
}
项目:hadoop    文件:Balancer.java   
private void matchSourceWithTargetToMove(Source source, StorageGroup target) {
  long size = Math.min(source.availableSizeToMove(), target.availableSizeToMove());
  final Task task = new Task(target, size);
  source.addTask(task);
  target.incScheduledSize(task.getSize());
  dispatcher.add(source, target);
  LOG.info("Decided to move "+StringUtils.byteDesc(size)+" bytes from "
      + source.getDisplayName() + " to " + target.getDisplayName());
}
项目:aliyun-oss-hadoop-fs    文件:Balancer.java   
private void matchSourceWithTargetToMove(Source source, StorageGroup target) {
  long size = Math.min(source.availableSizeToMove(), target.availableSizeToMove());
  final Task task = new Task(target, size);
  source.addTask(task);
  target.incScheduledSize(task.getSize());
  dispatcher.add(source, target);
  LOG.info("Decided to move "+StringUtils.byteDesc(size)+" bytes from "
      + source.getDisplayName() + " to " + target.getDisplayName());
}
项目:big-c    文件:Balancer.java   
private void matchSourceWithTargetToMove(Source source, StorageGroup target) {
  long size = Math.min(source.availableSizeToMove(), target.availableSizeToMove());
  final Task task = new Task(target, size);
  source.addTask(task);
  target.incScheduledSize(task.getSize());
  dispatcher.add(source, target);
  LOG.info("Decided to move "+StringUtils.byteDesc(size)+" bytes from "
      + source.getDisplayName() + " to " + target.getDisplayName());
}
项目:hadoop-2.6.0-cdh5.4.3    文件:Balancer.java   
private void matchSourceWithTargetToMove(Source source, StorageGroup target) {
  long size = Math.min(source.availableSizeToMove(), target.availableSizeToMove());
  final Task task = new Task(target, size);
  source.addTask(task);
  target.incScheduledSize(task.getSize());
  dispatcher.add(source, target);
  LOG.info("Decided to move "+StringUtils.byteDesc(size)+" bytes from "
      + source.getDisplayName() + " to " + target.getDisplayName());
}
项目:FlexMap    文件:Balancer.java   
private void matchSourceWithTargetToMove(Source source, StorageGroup target) {
  long size = Math.min(source.availableSizeToMove(), target.availableSizeToMove());
  final Task task = new Task(target, size);
  source.addTask(task);
  target.incScheduledSize(task.getSize());
  dispatcher.add(source, target);
  LOG.info("Decided to move "+StringUtils.byteDesc(size)+" bytes from "
      + source.getDisplayName() + " to " + target.getDisplayName());
}