// Path: chronix-server-client/src/main/java/de/qaware/chronix/solr/client/ChronixSolrStorageConstants.java
// public final class ChronixSolrStorageConstants {
// 
//     public static final String QUERY_START_LONG = "query_start_long";
//     public static final String QUERY_END_LONG = "query_end_long";
// 
//     private ChronixSolrStorageConstants() {
//         //avoid instances
//     }
// }


import java.util.Iterator;
import java.util.NoSuchElementException;
import java.util.concurrent.Executors;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.common.util.concurrent.MoreExecutors;
import de.qaware.chronix.converter.TimeSeriesConverter;
import de.qaware.chronix.solr.client.ChronixSolrStorageConstants;
import org.apache.solr.client.solrj.SolrClient;
import org.apache.solr.client.solrj.SolrQuery;
import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.client.solrj.response.QueryResponse;
import org.apache.solr.common.SolrDocument;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
            needStream = true;
            convertStream();
        }
        //Increment the document count
        currentDocumentCount += 1;
        //We are done
        if (currentDocumentCount == nrOfAvailableTimeSeries) {
            LOGGER.debug("Shutting down the thread pool while all points are converted.");
            service.shutdown();
        }
        //Someone calls next without calling hasNext()
        if (currentDocumentCount > nrOfAvailableTimeSeries) {
            throw new NoSuchElementException("Index " + currentDocumentCount + " greater than available time series " + nrOfAvailableTimeSeries);
        }

        return timeSeriesHandler.take();
    }

    private void streamNextDocumentsFromSolr() {
        SolrQuery solrQuery = query.getCopy();
        solrQuery.setRows(nrOfTimeSeriesPerBatch);
        solrQuery.setStart(currentDocumentCount);

        solrStreamingHandler.init(nrOfTimeSeriesPerBatch, currentDocumentCount);

        try {
            //Steam from solr
            connection.queryAndStreamResponse(solrQuery, solrStreamingHandler);
            //Convert the returning solr documents using the converter
            convertStream();
// Path: chronix-server-client/src/main/java/de/qaware/chronix/solr/client/ChronixSolrStorageConstants.java
// public final class ChronixSolrStorageConstants {
// 
//     public static final String QUERY_START_LONG = "query_start_long";
//     public static final String QUERY_END_LONG = "query_end_long";
// 
//     private ChronixSolrStorageConstants() {
//         //avoid instances
//     }
// }


// Path: chronix-server-client/src/main/java/de/qaware/chronix/solr/client/stream/SolrStreamingService.java
import java.util.Iterator;
import java.util.NoSuchElementException;
import java.util.concurrent.Executors;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.common.util.concurrent.MoreExecutors;
import de.qaware.chronix.converter.TimeSeriesConverter;
import de.qaware.chronix.solr.client.ChronixSolrStorageConstants;
import org.apache.solr.client.solrj.SolrClient;
import org.apache.solr.client.solrj.SolrQuery;
import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.client.solrj.response.QueryResponse;
import org.apache.solr.common.SolrDocument;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;

            needStream = true;
            convertStream();
        }
        //Increment the document count
        currentDocumentCount += 1;
        //We are done
        if (currentDocumentCount == nrOfAvailableTimeSeries) {
            LOGGER.debug("Shutting down the thread pool while all points are converted.");
            service.shutdown();
        }
        //Someone calls next without calling hasNext()
        if (currentDocumentCount > nrOfAvailableTimeSeries) {
            throw new NoSuchElementException("Index " + currentDocumentCount + " greater than available time series " + nrOfAvailableTimeSeries);
        }

        return timeSeriesHandler.take();
    }

    private void streamNextDocumentsFromSolr() {
        SolrQuery solrQuery = query.getCopy();
        solrQuery.setRows(nrOfTimeSeriesPerBatch);
        solrQuery.setStart(currentDocumentCount);

        solrStreamingHandler.init(nrOfTimeSeriesPerBatch, currentDocumentCount);

        try {
            //Steam from solr
            connection.queryAndStreamResponse(solrQuery, solrStreamingHandler);
            //Convert the returning solr documents using the converter
            convertStream();
        } catch (SolrServerException | IOException e) {