org.apache.solr.client.solrj.impl
Class ConcurrentUpdateSolrServer

java.lang.Object
  extended by org.apache.solr.client.solrj.SolrServer
      extended by org.apache.solr.client.solrj.impl.ConcurrentUpdateSolrServer
All Implemented Interfaces:
Serializable

public class ConcurrentUpdateSolrServer
extends SolrServer

ConcurrentUpdateSolrServer buffers all added documents and writes them into open HTTP connections. This class is thread safe. Params from UpdateRequest are converted to http request parameters. When params change between UpdateRequests a new HTTP request is started. Although any SolrServer request can be made with this implementation, it is only recommended to use ConcurrentUpdateSolrServer with /update requests. The class HttpSolrServer is better suited for the query interface.

See Also:
Serialized Form

Constructor Summary
ConcurrentUpdateSolrServer(String solrServerUrl, org.apache.http.client.HttpClient client, int queueSize, int threadCount)
           
ConcurrentUpdateSolrServer(String solrServerUrl, org.apache.http.client.HttpClient client, int queueSize, int threadCount, ExecutorService es)
          Uses the supplied HttpClient to send documents to the Solr server.
ConcurrentUpdateSolrServer(String solrServerUrl, org.apache.http.client.HttpClient client, int queueSize, int threadCount, ExecutorService es, boolean streamDeletes)
          Uses the supplied HttpClient to send documents to the Solr server.
ConcurrentUpdateSolrServer(String solrServerUrl, int queueSize, int threadCount)
          Uses an internally managed HttpClient instance.
 
Method Summary
 void blockUntilFinished()
           
 Set<String> getQueryParams()
           
 void handleError(Throwable ex)
           
 NamedList<Object> request(SolrRequest request)
          SolrServer implementations need to implement how a request is actually processed
 void setConnectionTimeout(int timeout)
           
 void setParser(ResponseParser responseParser)
           
 void setPollQueueTime(int pollQueueTime)
           
 void setQueryParams(Set<String> queryParams)
          Expert Method.
 void setRequestWriter(RequestWriter requestWriter)
           
 void setSoTimeout(int timeout)
          set soTimeout (read timeout) on the underlying HttpConnectionManager.
 void shutdown()
          Release allocated resources.
 void shutdownNow()
           
 
Methods inherited from class org.apache.solr.client.solrj.SolrServer
add, add, add, add, addBean, addBean, addBeans, addBeans, commit, commit, commit, deleteById, deleteById, deleteById, deleteById, deleteByQuery, deleteByQuery, getBinder, optimize, optimize, optimize, ping, query, query, queryAndStreamResponse, rollback
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConcurrentUpdateSolrServer

public ConcurrentUpdateSolrServer(String solrServerUrl,
                                  int queueSize,
                                  int threadCount)
Uses an internally managed HttpClient instance.

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

ConcurrentUpdateSolrServer

public ConcurrentUpdateSolrServer(String solrServerUrl,
                                  org.apache.http.client.HttpClient client,
                                  int queueSize,
                                  int threadCount)

ConcurrentUpdateSolrServer

public ConcurrentUpdateSolrServer(String solrServerUrl,
                                  org.apache.http.client.HttpClient client,
                                  int queueSize,
                                  int threadCount,
                                  ExecutorService es)
Uses the supplied HttpClient to send documents to the Solr server.


ConcurrentUpdateSolrServer

public ConcurrentUpdateSolrServer(String solrServerUrl,
                                  org.apache.http.client.HttpClient client,
                                  int queueSize,
                                  int threadCount,
                                  ExecutorService es,
                                  boolean streamDeletes)
Uses the supplied HttpClient to send documents to the Solr server.

Method Detail

getQueryParams

public Set<String> getQueryParams()

setQueryParams

public void setQueryParams(Set<String> queryParams)
Expert Method.

Parameters:
queryParams - set of param keys to only send via the query string

request

public NamedList<Object> request(SolrRequest request)
                          throws SolrServerException,
                                 IOException
Description copied from class: SolrServer
SolrServer implementations need to implement how a request is actually processed

Specified by:
request in class SolrServer
Throws:
SolrServerException
IOException

blockUntilFinished

public void blockUntilFinished()

handleError

public void handleError(Throwable ex)

shutdown

public void shutdown()
Description copied from class: SolrServer
Release allocated resources.

Specified by:
shutdown in class SolrServer

setConnectionTimeout

public void setConnectionTimeout(int timeout)

setSoTimeout

public void setSoTimeout(int timeout)
set soTimeout (read timeout) on the underlying HttpConnectionManager. This is desirable for queries, but probably not for indexing.


shutdownNow

public void shutdownNow()

setParser

public void setParser(ResponseParser responseParser)

setPollQueueTime

public void setPollQueueTime(int pollQueueTime)
Parameters:
pollQueueTime - time for an open connection to wait for updates when the queue is empty.

setRequestWriter

public void setRequestWriter(RequestWriter requestWriter)


Copyright © 2000-2014 Apache Software Foundation. All Rights Reserved.