/** * Uses the supplied HttpClient to send documents to the Solr server. */ public ConcurrentUpdateSolrClient(String solrServerUrl, HttpClient client, int queueSize, int threadCount, ExecutorService es, boolean streamDeletes) { this.client = new HttpSolrClient(solrServerUrl, client); this.client.setFollowRedirects(false); queue = new LinkedBlockingQueue<>(queueSize); this.threadCount = threadCount; runners = new LinkedList<>(); scheduler = es; this.streamDeletes = streamDeletes; }
protected ConcurrentUpdateSolrClient(Builder builder) { this.internalHttpClient = (builder.httpClient == null); this.client = new HttpSolrClient.Builder(builder.baseSolrUrl) .withHttpClient(builder.httpClient) .build(); this.client.setFollowRedirects(false); this.queue = new LinkedBlockingQueue<>(builder.queueSize); this.threadCount = builder.threadCount; this.runners = new LinkedList<>(); this.streamDeletes = builder.streamDeletes; this.connectionTimeout = builder.connectionTimeoutMillis; this.soTimeout = builder.socketTimeoutMillis; if (builder.executorService != null) { this.scheduler = builder.executorService; this.shutdownExecutor = false; } else { this.scheduler = ExecutorUtil.newMDCAwareCachedThreadPool(new SolrjNamedThreadFactory("concurrentUpdateScheduler")); this.shutdownExecutor = true; } if (log.isDebugEnabled()) { this.pollInterrupts = new AtomicInteger(); this.pollExits = new AtomicInteger(); this.blockLoops = new AtomicInteger(); this.emptyQueueLoops = new AtomicInteger(); } }
/** * Creates the datastore. * * @param url The URL of SOLR server * @param layerMapper The document loader. */ public SolrDataStore(URL url, SolrLayerMapper layerMapper) { // TODO: make connection timeouts configurable this.url = url; this.layerMapper = layerMapper; this.solrServer = new HttpSolrClient.Builder() .withBaseSolrUrl(url.toString()) .allowCompression(true) .build(); this.solrServer.setConnectionTimeout(10000); this.solrServer.setFollowRedirects(true); this.solrServer.setSoTimeout(10000); }
solrServer.setFollowRedirects(followRedirects);