Search in sources :

Example 1 with ResultLimitReachedException

use of com.hazelcast.sql.impl.ResultLimitReachedException in project hazelcast by hazelcast.

the class QueryResultProducerImpl method consume.

public void consume(Inbox inbox) {
    ensureNotDone();
    if (limit <= 0) {
        done.compareAndSet(null, new ResultLimitReachedException());
        ensureNotDone();
    }
    while (offset > 0 && inbox.poll() != null) {
        offset--;
    }
    for (JetSqlRow row; (row = (JetSqlRow) inbox.peek()) != null && rows.offer(row); ) {
        inbox.remove();
        if (limit != Long.MAX_VALUE) {
            limit -= 1;
            if (limit < 1) {
                done.compareAndSet(null, new ResultLimitReachedException());
                ensureNotDone();
            }
        }
    }
}
Also used : ResultLimitReachedException(com.hazelcast.sql.impl.ResultLimitReachedException) JetSqlRow(com.hazelcast.sql.impl.row.JetSqlRow)

Aggregations

ResultLimitReachedException (com.hazelcast.sql.impl.ResultLimitReachedException)1 JetSqlRow (com.hazelcast.sql.impl.row.JetSqlRow)1