141142143144145146147148149150151
// Check last. int lastIdx = ranges.size() - 1; GridGgfsFileAffinityRange last = ranges.get(lastIdx); if (last.startOffset() == range.startOffset()) { updateRangeStatus0(lastIdx, last, range, status); return; }
152153154155156157158159160161162
// Check first. int firstIdx = 0; GridGgfsFileAffinityRange first = ranges.get(firstIdx); if (first.startOffset() == range.startOffset()) { updateRangeStatus0(firstIdx, first, range, status); return; }
164165166167168169170171172173174
while (lastIdx - firstIdx > 1) { int midIdx = (firstIdx + lastIdx) / 2; GridGgfsFileAffinityRange midRange = ranges.get(midIdx); if (midRange.startOffset() == range.startOffset()) { updateRangeStatus0(midIdx, midRange, range, status); return; }