public static synchronized SolrServer getSolrServer(String url) { SolrServer server = servers.get(url); if(server == null) { logger.info("Connecting to Solr: " + url); HttpSolrServer httpServer = new HttpSolrServer(url); httpServer.setSoTimeout(Integer.parseInt(SolrMeterConfiguration.getProperty("solr.server.configuration.soTimeout", "60000"))); // socket read timeout httpServer.setConnectionTimeout(Integer.parseInt(SolrMeterConfiguration.getProperty("solr.server.configuration.connectionTimeout", "60000"))); httpServer.setDefaultMaxConnectionsPerHost(Integer.parseInt(SolrMeterConfiguration.getProperty("solr.server.configuration.defaultMaxConnectionsPerHost", "100000"))); httpServer.setMaxTotalConnections(Integer.parseInt(SolrMeterConfiguration.getProperty("solr.server.configuration.maxTotalConnections", "1000000"))); httpServer.setFollowRedirects(Boolean.parseBoolean(SolrMeterConfiguration.getProperty("solr.server.configuration.followRedirect", "false"))); // defaults to false httpServer.setAllowCompression(Boolean.parseBoolean(SolrMeterConfiguration.getProperty("solr.server.configuration.allowCompression", "true"))); httpServer.setMaxRetries(Integer.parseInt(SolrMeterConfiguration.getProperty("solr.server.configuration.maxRetries", "1"))); // defaults to 0. > 1 not recommended. setAuthentication(httpServer); servers.put(url, httpServer); return httpServer; } return server; }
queryEngine.setSoTimeout(10000); // socket read timeout queryEngine.setConnectionTimeout(10000); queryEngine.setDefaultMaxConnectionsPerHost(100); queryEngine.setMaxTotalConnections(100); queryEngine.setMaxRetries(1);