@Override public Tuple next() throws SQLException { List<RoundRobinIterator> iterators; int size; while ((size = (iterators = getIterators()).size()) > 0) { index = index % size; RoundRobinIterator itr = iterators.get(index); if (itr.getNumRecordsRead() < threshold) { Tuple tuple; if ((tuple = itr.peek()) != null) { tuple = itr.next(); if (itr.getNumRecordsRead() == threshold) { numScannersCacheExhausted++; } index = (index + 1) % size; return tuple; } else { // The underlying scanner is exhausted. Close the iterator and un-track it. itr.close(); iterators.remove(index); if (iterators.size() == 0) { close(); } } } else { index = (index + 1) % size; } } return null; }
@Override public Tuple next() throws SQLException { List<RoundRobinIterator> iterators; int size; while ((size = (iterators = getIterators()).size()) > 0) { index = index % size; RoundRobinIterator itr = iterators.get(index); if (itr.getNumRecordsRead() < threshold) { Tuple tuple; if ((tuple = itr.peek()) != null) { tuple = itr.next(); if (itr.getNumRecordsRead() == threshold) { numScannersCacheExhausted++; } index = (index + 1) % size; return tuple; } else { // The underlying scanner is exhausted. Close the iterator and un-track it. itr.close(); iterators.remove(index); if (iterators.size() == 0) { close(); } } } else { index = (index + 1) % size; } } return null; }
@Override public Tuple next() throws SQLException { List<RoundRobinIterator> iterators; int size; while ((size = (iterators = getIterators()).size()) > 0) { index = index % size; RoundRobinIterator itr = iterators.get(index); if (itr.getNumRecordsRead() < threshold) { Tuple tuple; if ((tuple = itr.peek()) != null) { tuple = itr.next(); if (itr.getNumRecordsRead() == threshold) { numScannersCacheExhausted++; } index = (index + 1) % size; return tuple; } else { // The underlying scanner is exhausted. Close the iterator and un-track it. itr.close(); iterators.remove(index); if (iterators.size() == 0) { close(); } } } else { index = (index + 1) % size; } } return null; }