本文整理汇总了Java中org.apache.hadoop.mapred.SortedRanges.Range.getLength方法的典型用法代码示例。如果您正苦于以下问题:Java Range.getLength方法的具体用法?Java Range.getLength怎么用?Java Range.getLength使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.hadoop.mapred.SortedRanges.Range
的用法示例。
在下文中一共展示了Range.getLength方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: add
import org.apache.hadoop.mapred.SortedRanges.Range; //导入方法依赖的package包/类
synchronized void add(Range failedRange) {
LOG.warn("FailedRange:"+ failedRange);
if(divide!=null) {
LOG.warn("FailedRange:"+ failedRange +" test:"+divide.test +
" pass:"+divide.testPassed);
if(divide.testPassed) {
//test range passed
//other range would be bad. test it
failedRange = divide.other;
}
else {
//test range failed
//other range would be good.
failedRange = divide.test;
}
//reset
divide = null;
}
if(maxSkipRecords==0 || failedRange.getLength()<=maxSkipRecords) {
skipRanges.add(failedRange);
} else {
//start dividing the range to narrow down the skipped
//records until maxSkipRecords are met OR all attempts
//get exhausted
divide = new Divide(failedRange);
}
}
示例2: Divide
import org.apache.hadoop.mapred.SortedRanges.Range; //导入方法依赖的package包/类
Divide(Range range){
long half = range.getLength()/2;
test = new Range(range.getStartIndex(), half);
other = new Range(test.getEndIndex(), range.getLength()-half);
//construct the skip range from the skipRanges
skipRange = new SortedRanges();
for(Range r : skipRanges.getRanges()) {
skipRange.add(r);
}
skipRange.add(new Range(0,test.getStartIndex()));
skipRange.add(new Range(test.getEndIndex(),
(Long.MAX_VALUE-test.getEndIndex())));
}