Search in sources :

Example 1 with OHighLevelException

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;
}
Also used : OHighLevelException(com.orientechnologies.common.exception.OHighLevelException) ORecord(com.orientechnologies.orient.core.record.ORecord) OHighLevelException(com.orientechnologies.common.exception.OHighLevelException) NoSuchElementException(java.util.NoSuchElementException)

Aggregations

OHighLevelException (com.orientechnologies.common.exception.OHighLevelException)1 ORecord (com.orientechnologies.orient.core.record.ORecord)1 NoSuchElementException (java.util.NoSuchElementException)1