public abstract class LBSolrClient extends SolrClient
Modifier and Type | Class and Description |
---|---|
static class |
LBSolrClient.Req |
static class |
LBSolrClient.Rsp |
protected static class |
LBSolrClient.ServerWrapper |
Modifier and Type | Field and Description |
---|---|
protected ResponseParser |
parser |
protected Set<String> |
queryParams |
protected RequestWriter |
requestWriter |
Constructor and Description |
---|
LBSolrClient(List<String> baseSolrUrls) |
Modifier and Type | Method and Description |
---|---|
void |
addQueryParams(String queryOnlyParam) |
void |
addSolrServer(String server) |
void |
close() |
protected LBSolrClient.ServerWrapper |
createServerWrapper(String baseUrl) |
protected Exception |
doRequest(String baseUrl,
LBSolrClient.Req req,
LBSolrClient.Rsp rsp,
boolean isNonRetryable,
boolean isZombie) |
protected abstract SolrClient |
getClient(String baseUrl) |
ResponseParser |
getParser() |
Set<String> |
getQueryParams() |
RequestWriter |
getRequestWriter() |
static String |
normalize(String server) |
protected LBSolrClient.ServerWrapper |
pickServer(LBSolrClient.ServerWrapper[] aliveServerList,
SolrRequest request)
Pick a server from list to execute request.
|
String |
removeSolrServer(String server) |
LBSolrClient.Rsp |
request(LBSolrClient.Req req)
Tries to query a live server from the list provided in Req.
|
NamedList<Object> |
request(SolrRequest request,
String collection)
Tries to query a live server.
|
NamedList<Object> |
request(SolrRequest request,
String collection,
Integer numServersToTry) |
void |
setAliveCheckInterval(int interval)
LBHttpSolrServer keeps pinging the dead servers at fixed interval to find if it is alive.
|
void |
setParser(ResponseParser parser)
Changes the
ResponseParser that will be used for the internal
SolrServer objects. |
void |
setQueryParams(Set<String> queryParams)
Expert Method.
|
void |
setRequestWriter(RequestWriter requestWriter)
Changes the
RequestWriter that will be used for the internal
SolrServer objects. |
protected void |
updateAliveList() |
add, add, add, add, add, add, add, add, add, add, addBean, addBean, addBean, addBean, addBeans, addBeans, addBeans, addBeans, addBeans, addBeans, commit, commit, commit, commit, commit, commit, deleteById, deleteById, deleteById, deleteById, deleteById, deleteById, deleteById, deleteById, deleteByQuery, deleteByQuery, deleteByQuery, deleteByQuery, getBinder, getById, getById, getById, getById, getById, getById, getById, getById, optimize, optimize, optimize, optimize, optimize, optimize, ping, ping, query, query, query, query, queryAndStreamResponse, queryAndStreamResponse, queryAndStreamResponse, request, rollback, rollback
protected volatile ResponseParser parser
protected volatile RequestWriter requestWriter
protected void updateAliveList()
protected LBSolrClient.ServerWrapper createServerWrapper(String baseUrl)
public void setQueryParams(Set<String> queryParams)
queryParams
- set of param keys to only send via the query stringpublic void addQueryParams(String queryOnlyParam)
public LBSolrClient.Rsp request(LBSolrClient.Req req) throws SolrServerException, IOException
req
- contains both the request as well as the list of servers to queryIOException
- If there is a low-level I/O error.SolrServerException
protected Exception doRequest(String baseUrl, LBSolrClient.Req req, LBSolrClient.Rsp rsp, boolean isNonRetryable, boolean isZombie) throws SolrServerException, IOException
SolrServerException
IOException
protected abstract SolrClient getClient(String baseUrl)
public void setAliveCheckInterval(int interval)
interval
- time in millisecondspublic ResponseParser getParser()
public void setParser(ResponseParser parser)
ResponseParser
that will be used for the internal
SolrServer objects.parser
- Default Response Parser chosen to parse the response if the parser
were not specified as part of the request.SolrRequest.getResponseParser()
public void setRequestWriter(RequestWriter requestWriter)
RequestWriter
that will be used for the internal
SolrServer objects.requestWriter
- Default RequestWriter, used to encode requests sent to the server.public RequestWriter getRequestWriter()
public void addSolrServer(String server) throws MalformedURLException
MalformedURLException
public NamedList<Object> request(SolrRequest request, String collection) throws SolrServerException, IOException
request
in class SolrClient
request
- the SolrRequest.collection
- the collection to execute the request againstIOException
- If there is a low-level I/O error.SolrServerException
- if there is an error on the serverpublic NamedList<Object> request(SolrRequest request, String collection, Integer numServersToTry) throws SolrServerException, IOException
SolrServerException
IOException
protected LBSolrClient.ServerWrapper pickServer(LBSolrClient.ServerWrapper[] aliveServerList, SolrRequest request)
aliveServerList
- list of currently alive serversrequest
- the request will be sent to the picked serverpublic void close()
Copyright © 2000-2021 Apache Software Foundation. All Rights Reserved.