@Nullable @Override public SolrClient getIndexingSolrServer() throws Exception { SolrClient server = getSolrServer(); if (server instanceof HttpSolrClient) { String url = ((HttpSolrClient) server).getBaseURL(); ConcurrentUpdateSolrClient concurrentUpdateSolrServer = new ConcurrentUpdateSolrClient(url, 1000, Runtime.getRuntime().availableProcessors()); concurrentUpdateSolrServer.setConnectionTimeout(remoteSolrServerConfiguration.getConnectionTimeout()); concurrentUpdateSolrServer.setSoTimeout(remoteSolrServerConfiguration.getSocketTimeout()); concurrentUpdateSolrServer.blockUntilFinished(); server = concurrentUpdateSolrServer; } return server; }
public void shutdownNow() { if (closed) { return; } closed = true; try { if (shutdownExecutor) { scheduler.shutdown(); interruptRunnerThreadsPolling(); scheduler.shutdownNow(); // Cancel currently executing tasks try { if (!scheduler.awaitTermination(30, TimeUnit.SECONDS)) log.error("ExecutorService did not terminate"); } catch (InterruptedException ie) { scheduler.shutdownNow(); Thread.currentThread().interrupt(); } } else { interruptRunnerThreadsPolling(); } } finally { if (internalHttpClient) IOUtils.closeQuietly(client); } }
@Override public void blockUntilFinished() { super.blockUntilFinished(); synchronized (myLock) { if (currentException != null) { throw new RuntimeException(currentException); } } }
&& (req.getDeleteByIdMap() == null || req.getDeleteByIdMap().isEmpty())) { if (req.getDeleteQuery() == null) { blockUntilFinished(); return client.request(request, collection); blockUntilFinished(); return client.request(request, collection); blockUntilFinished(); // empty the queue return client.request(request, collection); addRunner(); } else {
handleError(solrExc); } else { onSuccess(response); throw (OutOfMemoryError) e; handleError(e); } finally { synchronized (runners) {
/** * Create a {@link ConcurrentUpdateSolrClient} based on the provided configuration options. */ public ConcurrentUpdateSolrClient build() { if (baseSolrUrl == null) { throw new IllegalArgumentException("Cannot create HttpSolrClient without a valid baseSolrUrl!"); } return new ConcurrentUpdateSolrClient(this); }
try { waitForEmptyQueue(); interruptRunnerThreadsPolling(); addRunner(); interruptRunnerThreadsPolling();
throw (OutOfMemoryError) e; handleError(e); } finally { synchronized (runners) {
log.warn("No more runners, but queue still has " + queueSize + " adding more runners to process remaining requests on queue"); addRunner();
@Override public void blockUntilFinished() { super.blockUntilFinished(); synchronized (myLock) { if (currentException != null) { throw new RuntimeException(currentException); } } }
handleError(solrExc); } else { onSuccess(response);
this.adminServer = new ConcurrentUpdateSolrClient(SolrClientUrl, 1000, 10); this.server = new ConcurrentUpdateSolrClient( SolrClientUrl + "/" + mapping.getCoreName(), 1000, 10);
@Nullable @Override public SolrClient getIndexingSolrServer() throws Exception { SolrClient server = getSolrServer(); if (server instanceof HttpSolrClient) { String url = ((HttpSolrClient) server).getBaseURL(); ConcurrentUpdateSolrClient concurrentUpdateSolrServer = new ConcurrentUpdateSolrClient(url, 1000, Runtime.getRuntime().availableProcessors()); concurrentUpdateSolrServer.setConnectionTimeout(remoteSolrServerConfiguration.getConnectionTimeout()); concurrentUpdateSolrServer.setSoTimeout(remoteSolrServerConfiguration.getSocketTimeout()); concurrentUpdateSolrServer.blockUntilFinished(); server = concurrentUpdateSolrServer; } return server; }
@Override public void commitTransaction() throws SolrServerException, IOException { LOGGER.trace("commitTransaction"); if (batch.size() > 0) { loadBatch(); } if (numLoadedDocs > 0) { if (client instanceof ConcurrentUpdateSolrClient) { ((ConcurrentUpdateSolrClient) client).blockUntilFinished(); } } }
@Override public synchronized void close() { if (closed) { interruptRunnerThreadsPolling(); return; if (shutdownExecutor) { scheduler.shutdown(); interruptRunnerThreadsPolling(); try { if (!scheduler.awaitTermination(60, TimeUnit.SECONDS)) { interruptRunnerThreadsPolling();
@Override public void commitTransaction() throws SolrServerException, IOException { LOGGER.trace("commitTransaction"); if (batch.size() > 0) { sendBatch(); } if (numSentItems > 0) { SolrClient s = getNonRetryingSolrServer(); if (s instanceof ConcurrentUpdateSolrClient) { ((ConcurrentUpdateSolrClient) s).blockUntilFinished(); } } }
&& (req.getDeleteByIdMap() == null || req.getDeleteByIdMap().isEmpty())) { if (req.getDeleteQuery() == null) { blockUntilFinished(); return client.request(request, collection); blockUntilFinished(); return client.request(request, collection); blockUntilFinished(); // empty the queue return client.request(request, collection);