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();
}
}
}
}
Aggregations