presto-thrift/src/main/java/io/prestosql/plugin/thrift/ThriftIndexPageSource.java/ThriftIndexPageSource/getAndRemoveNextCompletedRequest
class ThriftIndexPageSource:    private ListenableFuture<PrestoThriftPageResult> getAndRemoveNextCompletedRequest()
    {
        Iterator<ListenableFuture<PrestoThriftPageResult>> iterator = dataRequests.iterator();
        while (iterator.hasNext()) {
            ListenableFuture<PrestoThriftPageResult> future = iterator.next();
            if (future.isDone()) {
                iterator.remove();
                return future;
            }
        }
        throw new IllegalStateException("No completed splits in the queue");
    }