Revision 55639
Added by Katerina Iatropoulou almost 5 years ago
SolrResultSetFactory.java | ||
---|---|---|
17 | 17 |
public class SolrResultSetFactory implements ResultSetFactory { |
18 | 18 |
|
19 | 19 |
private Logger logger = Logger.getLogger(getClass()); |
20 |
private Map<String, CloudSolrClient> clients = new HashMap<String, CloudSolrClient>(); |
|
20 | 21 |
|
21 | 22 |
@Override |
22 | 23 |
public ResultSet<String> createResultSet(EPR epr) { |
23 | 24 |
try { |
24 | 25 |
|
25 | 26 |
String[] zkservers= epr.getAddress().split(","); |
26 |
CloudSolrClient solrClient = new CloudSolrClient.Builder().withZkHost(Arrays.asList(zkservers)).build(); |
|
27 | 27 |
|
28 |
CloudSolrClient solrClient; |
|
29 |
|
|
30 |
synchronized (clients) { |
|
31 |
solrClient = clients.get(epr.getAddress()); |
|
32 |
} |
|
33 |
if (solrClient == null) { |
|
34 |
solrClient = new CloudSolrClient.Builder().withZkHost(Arrays.asList(zkservers)).build(); |
|
35 |
|
|
36 |
clients.put(epr.getAddress(), solrClient); |
|
37 |
} |
|
38 |
|
|
28 | 39 |
ResultSet<String> solrResultSets = new SolrResultSet(epr, solrClient); |
29 | 40 |
|
30 | 41 |
return solrResultSets; |
Also available in: Unified diff
Latest for solr7 + deletedByInferencePublications method added #4216