## org.apache.solr.client.solrj.impl
Class StreamingUpdateSolrServer

    java.lang.Object
      org.apache.solr.client.solrj.SolrServer
          org.apache.solr.client.solrj.impl.CommonsHttpSolrServer
              org.apache.solr.client.solrj.impl.StreamingUpdateSolrServer

All Implemented Interfaces:
  Serializable

    public class StreamingUpdateSolrServer

extends CommonsHttpSolrServer

`StreamingUpdateSolrServer` buffers all added documents and writes them into open HTTP connections. This class is thread safe. Although any SolrServer request can be made with this implementation, it is only recommended to use the `StreamingUpdateSolrServer` with /update requests. The query interface is better suited for

Since:
  solr 1.4
Version:
  $Id: CommonsHttpSolrServer.java 724175 2008-12-07 19:07:11Z ryan $
See Also:
  Serialized Form

Field Summary

Fields inherited from class org.apache.solr.client.solrj.impl.CommonsHttpSolrServer
`_baseURL, _invariantParams, _parser, AGENT, requestWriter`

Constructor Summary
`StreamingUpdateSolrServer(String solrServerUrl, org.apache.commons.httpclient.HttpClient client, int queueSize, int threadCount)` Uses the supplied HttpClient to send documents to the Solr server, the HttpClient should be instantiated using a MultiThreadedHttpConnectionManager.
`StreamingUpdateSolrServer(String solrServerUrl, int queueSize, int threadCount)` Uses an internal MultiThreadedHttpConnectionManager to manage http connections

Method Summary
`void` `blockUntilFinished()`
`void` `handleError(Throwable ex)`
`NamedList<Object>` `request(SolrRequest request)` Process the request.

Methods inherited from class org.apache.solr.client.solrj.impl.CommonsHttpSolrServer
`add, addBeans, getBaseURL, getHttpClient, getInvariantParams, getParser, request, setAllowCompression, setBaseURL, setConnectionManagerTimeout, setConnectionManagerTimeout, setConnectionTimeout, setDefaultMaxConnectionsPerHost, setFollowRedirects, setMaxRetries, setMaxTotalConnections, setParser, setRequestWriter, setSoTimeout`

Methods inherited from class org.apache.solr.client.solrj.SolrServer
`add, add, addBean, addBeans, commit, commit, deleteById, deleteById, deleteByQuery, getBinder, optimize, optimize, optimize, ping, query, query, rollback`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### StreamingUpdateSolrServer

    public StreamingUpdateSolrServer(String solrServerUrl,
                                     int queueSize,
                                     int threadCount)
                              throws MalformedURLException

  Uses an internal MultiThreadedHttpConnectionManager to manage http connections

  Parameters:
    `solrServerUrl` - The Solr server URL
    `queueSize` - The buffer size before the documents are sent to the server
    `threadCount` - The number of background threads used to empty the queue
  Throws:
    `MalformedURLException`

### StreamingUpdateSolrServer

    public StreamingUpdateSolrServer(String solrServerUrl,
                                     org.apache.commons.httpclient.HttpClient client,
                                     int queueSize,
                                     int threadCount)
                              throws MalformedURLException

  Uses the supplied HttpClient to send documents to the Solr server, the HttpClient should be instantiated using a MultiThreadedHttpConnectionManager.

  Throws:
    `MalformedURLException`

Method Detail

### request

    public NamedList<Object> request(SolrRequest request)
                              throws SolrServerException,
                                     IOException

  Description copied from class: `CommonsHttpSolrServer`
  Process the request. If `SolrRequest.getResponseParser()` is null, then use `CommonsHttpSolrServer.getParser()`

  Overrides:
    `request` in class `CommonsHttpSolrServer`
  Parameters:
    `request` - The `SolrRequest` to process
  Returns:
    The `NamedList` result
  Throws:
    `SolrServerException`
    `IOException`
  See Also:
    `CommonsHttpSolrServer.request(org.apache.solr.client.solrj.SolrRequest, org.apache.solr.client.solrj.ResponseParser)`

### blockUntilFinished

    public void blockUntilFinished()

### handleError

    public void handleError(Throwable ex)

Copyright © 2011 Apache Software Foundation. All Rights Reserved.