use of com.orientechnologies.common.exception.OHighLevelException in project orientdb by orientechnologies.
the class ORecordIteratorClusters method hasNext.
public boolean hasNext() {
checkDirection(true);
if (Thread.interrupted())
// INTERRUPTED
return false;
if (currentRecord != null)
return true;
if (limit > -1 && browsedRecords >= limit)
// LIMIT REACHED
return false;
if (browsedRecords >= totalAvailableRecords)
return false;
// COMPUTE THE NUMBER OF RECORDS TO BROWSE
if (liveUpdated)
updateClusterRange();
ORecord record = getRecord();
// ITERATE UNTIL THE NEXT GOOD RECORD
while (currentClusterIdx < clusterIds.length) {
while (nextPosition()) {
if (outsideOfTheRange(current))
continue;
try {
currentRecord = readCurrentRecord(record, 0);
} catch (Exception e) {
if ((e instanceof RuntimeException) && (e instanceof OHighLevelException))
throw (RuntimeException) e;
OLogManager.instance().error(this, "Error during read of record", e);
currentRecord = null;
}
if (currentRecord != null)
if (include(currentRecord))
// FOUND
return true;
}
// CLUSTER EXHAUSTED, TRY WITH THE NEXT ONE
currentClusterIdx++;
if (currentClusterIdx >= clusterIds.length)
break;
updateClusterRange();
}
// CHECK IN TX IF ANY
if (txEntries != null && txEntries.size() - (currentTxEntryPosition + 1) > 0)
return true;
currentRecord = null;
return false;
}
Aggregations