protected String determineCoreName(HttpSolrClient httpSolrClient) { String url = httpSolrClient.getBaseURL(); String coreName = url.substring(url.lastIndexOf('/') + 1); return coreName; }
@Override public String toString() { return client.getBaseURL(); }
public String getKey() { return client.getBaseURL(); }
@Override public String toString() { return client.getBaseURL(); }
public String getKey() { return client.getBaseURL(); }
protected String getBaseUrl(HttpSolrClient client) { return client .getBaseURL().substring( 0, client.getBaseURL().length() - DEFAULT_COLLECTION.length() - 1); }
private void addRunner() { MDC.put("ConcurrentUpdateSolrClient.url", client.getBaseURL()); try { Runner r = new Runner(); runners.add(r); try { scheduler.execute(r); // this can throw an exception if the scheduler has been shutdown, but that should be fine. } catch (RuntimeException e) { runners.remove(r); throw e; } } finally { MDC.remove("ConcurrentUpdateSolrClient.url"); } }
protected void setupRestTestHarnesses() { for (final SolrClient client : clients) { RestTestHarness harness = new RestTestHarness(() -> ((HttpSolrClient) client).getBaseURL()); restTestHarnesses.add(harness); } }
@Override public List<String> createTypeNames(HttpSolrClient solr) throws Exception { // try to parse the url and return the name of the core try { URL url = new URL(solr.getBaseURL()); String[] path = url.getPath() != null ? url.getPath().split("/") : null; if (path != null && path.length > 0) { String last = path[path.length - 1]; if (!last.trim().isEmpty()) { return Arrays.asList(last); } } } catch (MalformedURLException e) { LOGGER.log(Level.FINE, "unable to parse solr url: " + solr.getBaseURL(), e); } // default return Arrays.asList("index"); }
log.warn("No more runners, but queue still has "+ queueSize+" adding more runners to process remaining requests on queue"); MDC.put("ConcurrentUpdateSolrClient.url", client.getBaseURL()); try { Runner r = new Runner();
@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; }
@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; }
case HttpStatus.SC_MOVED_TEMPORARILY: if (!followRedirects) { throw new SolrServerException("Server at " + getBaseURL() + " sent back a redirect (" + httpStatus + ")."); } catch (ConnectException e) { throw new SolrServerException("Server refused connection at: " + getBaseURL(), e); } catch (SocketTimeoutException e) { throw new SolrServerException( "Timeout occured while waiting response from server at: " + getBaseURL(), e); } catch (IOException e) { throw new SolrServerException( "IOException occured when talking to server at: " + getBaseURL(), e); } finally { if (respBody != null && shouldClose) {
requestParams.set(CommonParams.VERSION, client.parser.getVersion()); String basePath = client.getBaseURL(); if (update.getCollection() != null) basePath += "/" + update.getCollection(); log.warn("Failed to parse error response from " + client.getBaseURL() + " due to: " + exc); } finally { solrExc = new HttpSolrClient.RemoteSolrException(client.getBaseURL(), statusCode, msg.toString(), null); if (metadata != null) { solrExc.setMetadata(metadata);
MDC.put("LBHttpSolrClient.url", wrapper.client.getBaseURL()); ++numServersTried; ex = doRequest(wrapper.client, req, rsp, isNonRetryable, true, wrapper.getKey());
int port = new URI(((HttpSolrClient) client).getBaseURL()) .getPort();
MDC.put("ConcurrentUpdateSolrClient.url", client.getBaseURL()); try { Runner r = new Runner();
Exception ex = null; try { rsp.server = client.getBaseURL(); rsp.rsp = client.request(req.getRequest(), (String) null); if (isZombie) {
public static void waitForNon403or404or503(HttpSolrClient collectionClient) throws Exception { SolrException exp = null; final TimeOut timeout = new TimeOut(30, TimeUnit.SECONDS, TimeSource.NANO_TIME); while (! timeout.hasTimedOut()) { boolean missing = false; try { collectionClient.query(new SolrQuery("*:*")); } catch (SolrException e) { if (!(e.code() == 403 || e.code() == 503 || e.code() == 404)) { throw e; } exp = e; missing = true; } if (!missing) { return; } Thread.sleep(50); } fail("Could not find the new collection - " + exp.code() + " : " + collectionClient.getBaseURL()); }
for (Map.Entry<String,Replica> shard : theShards.entrySet()) { String shardName = new URI( ((HttpSolrClient) client.solrClient).getBaseURL()).getPort() + "_solr_"; if (verbose && shard.getKey().endsWith(shardName)) {