org.apache.solr.client.solrj.io

## Class CloudSolrStream

- java.lang.Object
- - org.apache.solr.client.solrj.io.TupleStream
  - - org.apache.solr.client.solrj.io.CloudSolrStream

All Implemented Interfaces:
  Serializable

Direct Known Subclasses:
  ParallelStream

    public class CloudSolrStream
    extends TupleStream

Connects to Zookeeper to pick replicas from a specific collection to send the query to. Under the covers the SolrStream instances send the query to the replicas. SolrStreams are opened using a thread pool, but a single thread is used to iterate and merge Tuples from each SolrStream.

See Also:
  Serialized Form

### Nested Class Summary

Nested Classes
`protected class` `CloudSolrStream.StreamOpener`
`protected class` `CloudSolrStream.TupleWrapper`

### Field Summary

Fields
`protected SolrClientCache` `cache`
`protected CloudSolrClient` `cloudSolrClient`
`protected String` `collection`
`protected Comparator<Tuple>` `comp`
`protected Map<String,Tuple>` `eofTuples`
`protected Map` `params`
`protected List<TupleStream>` `solrStreams`
`protected StreamContext` `streamContext`
`protected TreeSet<CloudSolrStream.TupleWrapper>` `tuples`
`protected String` `zkHost`

### Constructor Summary

Constructors
`protected` `CloudSolrStream()`
`` `CloudSolrStream(String zkHost, String collection, Map params)`

### Method Summary

Methods
`protected Tuple` `_read()`
`List<TupleStream>` `children()`
`void` `close()` Closes the CloudSolrStream
`protected void` `constructStreams()`
`Map` `getEofTuples()`
`void` `open()` Opens the CloudSolrStream
`Tuple` `read()`
`void` `setComp(Comparator<Tuple> comp)`
`void` `setFieldMappings(Map<String,String> fieldMappings)`
`void` `setStreamContext(StreamContext context)`
`void` `setTrace(boolean trace)`

### Methods inherited from class org.apache.solr.client.solrj.io.TupleStream

`getCost`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### zkHost

    protected String zkHost

#### collection

    protected String collection

#### params

    protected Map params

#### comp

    protected Comparator<Tuple> comp

#### eofTuples

    protected transient Map<String,Tuple> eofTuples

#### cache

    protected transient SolrClientCache cache

#### cloudSolrClient

    protected transient CloudSolrClient cloudSolrClient

#### solrStreams

    protected transient List<TupleStream> solrStreams

#### tuples

    protected transient TreeSet<CloudSolrStream.TupleWrapper> tuples

#### streamContext

    protected transient StreamContext streamContext

### Constructor Detail

#### CloudSolrStream

    public CloudSolrStream(String zkHost,
                   String collection,
                   Map params)
                    throws IOException

Throws:
  `IOException`

#### CloudSolrStream

    protected CloudSolrStream()

### Method Detail

#### setComp

    public void setComp(Comparator<Tuple> comp)

#### setFieldMappings

    public void setFieldMappings(Map<String,String> fieldMappings)

#### setTrace

    public void setTrace(boolean trace)

#### setStreamContext

    public void setStreamContext(StreamContext context)

Specified by:
  `setStreamContext` in class `TupleStream`

#### open

    public void open()
              throws IOException

Opens the CloudSolrStream

Specified by:
  `open` in class `TupleStream`
Throws:
  `IOException`

#### getEofTuples

    public Map getEofTuples()

#### children

    public List<TupleStream> children()

Specified by:
  `children` in class `TupleStream`

#### constructStreams

    protected void constructStreams()
                             throws IOException

Throws:
  `IOException`

#### close

    public void close()
               throws IOException

Closes the CloudSolrStream

Specified by:
  `close` in class `TupleStream`
Throws:
  `IOException`

#### read

    public Tuple read()
               throws IOException

Specified by:
  `read` in class `TupleStream`
Throws:
  `IOException`

#### _read

    protected Tuple _read()
                   throws IOException

Throws:
  `IOException`