Find out if there are any more elements available; this method
will perform prefetching from the remote result set.
337278
public synchronized boolean hasMoreElementsR()
                    throws RemoteException, EnumeratorException
    {
        if (elements != null && index < elements.length) {
            return true;

        } else if (!exhausted) {

            // Reset our local cache and attempt to fetch the next batch
            // from the server

            try {
                elements = null;
                index = 0;
                elements = fetchElements(PREFETCH_COUNT);
                return true;
            } catch (NoMoreElementsException ex) {
                // We've exhausted the remote result set
                // FFDCFilter.processException(ex, CLASS_NAME + ".hasMoreElementsR",
                //                             "172", this);
                return false;
            }

        }

        // Exhausted!
        return false;

    }
659585
private void fetch() {
    	next.clear();
        // We need to remember for what thread the IEnumVARIANT was marshaled. Because if we want to interpret this
        // VARIANT as an interface pointer later on, we need to do this in the same thread!
        next.thread = e.getComThread();
        int r = e.next(1,next);
        if(r==0) {
            next = null;
            e.dispose();
        }
    }
1215702
private boolean nextWithoutLimit() throws SQLException {
		if (maxRows > 0 && rowsFetched >= maxRows) {
			System.out.println("Reach max rows " + maxRows);
			return false;
		}

		if ((recordItr == null || !recordItr.hasNext()) && !emptyResultSet) {
			TSFetchResultsReq req = new TSFetchResultsReq(sql, fetchSize);

			try {
				TSFetchResultsResp resp = client.fetchResults(req);
				Utils.verifySuccess(resp.getStatus());
				if (!resp.hasResultSet) {
					emptyResultSet = true;
				} else {
					TSQueryDataSet tsQueryDataSet = resp.getQueryDataSet();
					List<RowRecord> records = Utils.convertRowRecords(tsQueryDataSet);
					recordItr = records.iterator();
				}
			} catch (TException e) {
				throw new SQLException("Cannot fetch result from server, because of network connection");
			}

		}
		if (emptyResultSet) {
			return false;
		}
		record = recordItr.next();
		// if(record.getDeltaObjectType() != null &&
		// record.getDeltaObjectType().equals(AGGREGATION_STR)){
		// if(columnInfo.containsKey(TIMESTAMP_STR)){
		// columnInfo.remove(TIMESTAMP_STR);
		// }
		// }

		rowsFetched++;
        // maxRows is a constraint that exists in parallel with the LIMIT&SLIMIT constraints,
        // so rowsFetched will increase whenever the row is fetched,
        // regardless of whether the row satisfies the LIMIT&SLIMIT constraints or not.

		return true;
	}
218950
private Collection<T> getMoreCandidates() {
        final Predicate<T> unusedPredicate = new UnusedServer();
        final Collection<T> servers = new LinkedList<T>();

        // We limit the number of times we try to retrieve more candidates. If
        // we try several times and fail, we just return an empty collection.
        int tries = 0;

        // We pull candidate URIs from the candidate provider.
        while (servers.isEmpty() && (tries < 3)) {
            LOG.debug("Trying to find candidate servers");

            // If we have been flagged to sleep before trying to get more
            // candidates, sleep before trying to get more candidates.
            if (m_sleepBeforeTryingToGetMoreCandidates) {
                LOG.debug("Long sleep...");
                ThreadUtils.safeSleep(60000);
            } else if (!m_firstRun) {
                LOG.debug("Short sleep...");
                // Always sleep for a little while to avoid hammering the
                // server.
                ThreadUtils.safeSleep(10000);
            }

            m_firstRun = false;

            final Collection<T> candidates = m_candidateProvider
                    .getCandidates();

            LOG.debug("Found candidates...");
            // We only accept servers that we have not already used. This
            // prevents us from establishing connections with the same
            // servers more than once.
            final Collection<T> unusedCandidates = m_collectionUtils.select(
                    candidates, unusedPredicate);

            servers.addAll(unusedCandidates);

            ++tries;
        }

        LOG.debug("Found this many candidate servers: " + servers.size());

        return servers;
    }
857632
public boolean hasMoreElements()
    {
        try
        {
            if (!hasCalledCheck)
            {
                hasCalledCheck = true;
                hasNext = resultSetAndStatment.m_rs.next();
            }
        }
        catch (SQLException e)
        {
            LoggerFactory.getDefaultLogger().error(e);
            //releaseDbResources();
            hasNext = false;
        }
        finally
        {
            if(!hasNext)
            {
                releaseDbResources();
            }
        }
        return hasNext;
    }
118010
private synchronized boolean loadNextResults() {
        if ( atEndOfResults() )
            return false;

        do {
            nextResults.addAll(fetchNextPage());
        } while ( !atEndOfResults() && nextResults.isEmpty() );

        return !nextResults.isEmpty();
    }
1201465
public boolean hasNext() {
        // check if we already fetched next item
        if (next != null) {
            return true;
        }

        // check if result set already finished
        if (resultSetFinished) {
            return false;
        }

        // now fetch next item
        next = safeReadNext();

        // check if we got something
        if (next != null) {
            return true;
        }

        // no more items
        resultSetFinished = true;

        return false;
    }
1340345
public boolean hasPrevious() {
        // If we are at the start of the list there are no previous elements.
        if (currentIndex == startIndex) {
            return false;
        }
        // Otherwise, see if previous Element is null. If so, try to load the
        // previous element to make sure it exists.
        if (previousElement == null) {
            previousElement = getPreviousElement();
            // If getting the previous element failed, return false.
            if (previousElement == null) {
                return false;
            }
        }
        return true;
    }
897196
def prefetchDeclarativeIds(self, Declarative, count) -> Deferred:
        
        return self._dbConn.prefetchDeclarativeIds(Declarative=Declarative, count=count)
501538
public Deferred<TreeMap<byte[], Span>> fetch() {
    if(tags.isEmpty()) {
      return Deferred.fromResult(null);
    }
    startFetch();
    return results;
  }
1125230
def items(self):
        
        if self.matcher:
            for item in self._fetch_items():
                if self.matcher.match(item):
                    yield item
        else:
            for item in self._fetch_items():
                yield item
1032807
synchronized void result(@Nullable T res) {
        if (isFinished) {
            throw new RuntimeException("Promise " + this + " already completed!");
        }
        isFinished = true;
        result = res;
        deliverResult();
    }
1296661
public void performRetrievalTasks()
    {
        if (m_retrievalTasks == null)
        {
            return;
        }

        while (m_retrievalTasks.size() > 0)
        {
            HashMap tmp = m_retrievalTasks;
            m_retrievalTasks = new HashMap();
            // during execution of these tasks new tasks may be added

            for (Iterator it = tmp.entrySet().iterator(); it.hasNext(); )
            {
                Map.Entry entry = (Map.Entry) it.next();
                Object key = entry.getKey();

                if (!(key instanceof ObjectReferenceDescriptor))
                {
                    continue;
                }

                ObjectReferenceDescriptor ord = (ObjectReferenceDescriptor) key;
                RelationshipPrefetcher prefetcher;
                ArrayList owners = (ArrayList) entry.getValue();

//                if (ord instanceof SuperReferenceDescriptor || ord.isLazy() || (ord.getItemProxyClass() != null))
                if (ord.isLazy() || (ord.getItemProxyClass() != null))
                {
                    continue;
                }

                prefetcher = pb.getRelationshipPrefetcherFactory().createRelationshipPrefetcher(ord);
                prefetcher.prefetchRelationship(owners);
                it.remove();
            }
        }
    }
273316
def next(self):
        
        if not self._cache:
            self._cache = self._get_results()
            self._retrieved += len(self._cache)

        # If we don't have any other data to return, we just
        # stop the iteration.
        if not self._cache:
            raise StopIteration()

        # Consuming the cache and updating the "cursor"
        return self._cache.pop(0)
357691
private boolean toBoundedPrevious() throws FetchException {
        if (!toPrevious()) {
            return false;
        }

        if (mStartBound != null) {
            byte[] currentKey = getCurrentKey();
            if (currentKey == null) {
                return false;
            }
            int result = compareKeysPartially(currentKey, mStartBound);
            if (result <= 0) {
                if (result < 0 || !mInclusiveStart) {
                    // Too far now, reset to first.
                    toBoundedFirst();
                    return false;
                }
            }
        }

        return prefixMatches();
    }
47538
def fetchmany(self, size=None):
        
        self._check_closed()
        if not self._executed:
            raise ProgrammingError("Require execute() first")
        if size is None:
            size = self.arraysize

        result = []
        cnt = 0
        while cnt != size:
            try:
                result.append(next(self._buffer))
                cnt += 1
            except StopIteration:
                break

        if cnt == size or self._received_last_resultset_part:
            # No rows are missing or there are no additional rows
            return result

        request = RequestMessage.new(
            self.connection,
            RequestSegment(
                message_types.FETCHNEXT,
                (ResultSetId(self._resultset_id), FetchSize(size - cnt))
            )
        )
        response = self.connection.send_request(request)

        resultset_part = response.segments[0].parts[1]
        if resultset_part.attribute & 1:
            self._received_last_resultset_part = True
        result.extend(resultset_part.unpack_rows(self._column_types, self.connection))
        return result
43917
@Override
    public void nextTuple()
    {
        if (this.reloadConfig && this.watcher != null)
        {
            Map<String, Object> reloadedConfig = null;

            try
            {
                reloadedConfig = this.watcher.readIfUpdated();
            }
            catch (IOException ex)
            {
                String logFormat = "Config file reload failed. Skip reload config.";
                logger.warn(logFormat, ex);
            }

            if (reloadedConfig != null)
            {
                onUpdate(reloadedConfig);
            }
        }

        onNextTuple();
    }