当前位置: 首页>>代码示例>>Java>>正文


Java HttpSolrServer.setMaxTotalConnections方法代码示例

本文整理汇总了Java中org.apache.solr.client.solrj.impl.HttpSolrServer.setMaxTotalConnections方法的典型用法代码示例。如果您正苦于以下问题:Java HttpSolrServer.setMaxTotalConnections方法的具体用法?Java HttpSolrServer.setMaxTotalConnections怎么用?Java HttpSolrServer.setMaxTotalConnections使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.solr.client.solrj.impl.HttpSolrServer的用法示例。


在下文中一共展示了HttpSolrServer.setMaxTotalConnections方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getNewHttpSolrServer

import org.apache.solr.client.solrj.impl.HttpSolrServer; //导入方法依赖的package包/类
/**
 * 
 * @param indexUrl
 * @return
 */
public static HttpSolrServer getNewHttpSolrServer(String indexUrl) {
    if (indexUrl == null) {
        throw new IllegalArgumentException("indexUrl may not be null");
    }
    HttpSolrServer server = new HttpSolrServer(indexUrl);
    server.setSoTimeout(TIMEOUT_SO); // socket read timeout
    server.setConnectionTimeout(TIMEOUT_CONNECTION);
    server.setDefaultMaxConnectionsPerHost(100);
    server.setMaxTotalConnections(100);
    server.setFollowRedirects(false); // defaults to false
    server.setAllowCompression(true);
    server.setMaxRetries(1); // defaults to 0. > 1 not recommended.
    // server.setParser(new XMLResponseParser()); // binary parser is used by default
    server.setRequestWriter(new BinaryRequestWriter());

    return server;
}
 
开发者ID:intranda,项目名称:goobi-viewer-connector,代码行数:23,代码来源:SolrSearchIndex.java

示例2: createNewSolrServer

import org.apache.solr.client.solrj.impl.HttpSolrServer; //导入方法依赖的package包/类
@Override
public SolrServer createNewSolrServer()
{
  try {
    // setup the server...
    String url = jetty.getBaseUrl().toString() + "/collection1";
    HttpSolrServer s = new HttpSolrServer( url );
    s.setConnectionTimeout(DEFAULT_CONNECTION_TIMEOUT);
    s.setDefaultMaxConnectionsPerHost(100);
    s.setMaxTotalConnections(100);
    s.setUseMultiPartPost(random().nextBoolean());

    // where the magic happens
    s.setParser(new BinaryResponseParser());
    s.setRequestWriter(new BinaryRequestWriter());

    return s;
  }
  catch( Exception ex ) {
    throw new RuntimeException( ex );
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:23,代码来源:SolrExampleBinaryTest.java

示例3: createNewSolrServer

import org.apache.solr.client.solrj.impl.HttpSolrServer; //导入方法依赖的package包/类
@Override
public SolrServer createNewSolrServer() {
  try {
    // setup the server...
    String url = jetty.getBaseUrl().toString() + "/collection1";
    HttpSolrServer s = new HttpSolrServer(url);
    s.setConnectionTimeout(DEFAULT_CONNECTION_TIMEOUT);
    s.setDefaultMaxConnectionsPerHost(100);
    s.setMaxTotalConnections(100);
    s.setUseMultiPartPost(random().nextBoolean());
    
    if (random().nextBoolean()) {
      s.setParser(new BinaryResponseParser());
      s.setRequestWriter(new BinaryRequestWriter());
    }
    
    return s;
  } catch (Exception ex) {
    throw new RuntimeException(ex);
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:22,代码来源:SolrSchemalessExampleTests.java

示例4: createNewSolrServer

import org.apache.solr.client.solrj.impl.HttpSolrServer; //导入方法依赖的package包/类
@Override
public SolrServer createNewSolrServer() {
  try {
    String url = jetty.getBaseUrl().toString() + "/collection1";
    HttpSolrServer s = new HttpSolrServer(url);
    s.setUseMultiPartPost(random().nextBoolean());
    s.setConnectionTimeout(DEFAULT_CONNECTION_TIMEOUT);
    s.setDefaultMaxConnectionsPerHost(100);
    s.setMaxTotalConnections(100);
    s.setParser(new XMLResponseParser());
    s.setRequestWriter(new RequestWriter());
    return s;
  } catch (Exception ex) {
    throw new RuntimeException(ex);
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:17,代码来源:SolrExampleXMLTest.java

示例5: createNewSolrServer

import org.apache.solr.client.solrj.impl.HttpSolrServer; //导入方法依赖的package包/类
/**
 * Create a new solr server.
 * If createJetty was called, an http implementation will be created,
 * otherwise an embedded implementation will be created.
 * Subclasses should override for other options.
 */
public SolrServer createNewSolrServer() {
  if (jetty != null) {
    try {
      // setup the server...
      String url = jetty.getBaseUrl().toString() + "/" + "collection1";
      HttpSolrServer s = new HttpSolrServer( url );
      s.setConnectionTimeout(DEFAULT_CONNECTION_TIMEOUT);
      s.setDefaultMaxConnectionsPerHost(100);
      s.setMaxTotalConnections(100);
      return s;
    }
    catch( Exception ex ) {
      throw new RuntimeException( ex );
    }
  } else {
    return new EmbeddedSolrServer( h.getCoreContainer(), "" );
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:25,代码来源:SolrJettyTestBase.java

示例6: createNewSolrServer

import org.apache.solr.client.solrj.impl.HttpSolrServer; //导入方法依赖的package包/类
@Override
protected SolrServer createNewSolrServer(int port) {
  try {
    // setup the server...
    String baseUrl = buildUrl(port);
    String url = baseUrl + (baseUrl.endsWith("/") ? "" : "/") + DEFAULT_COLLECTION;
    HttpSolrServer s = new HttpSolrServer(url);
    s.setConnectionTimeout(DEFAULT_CONNECTION_TIMEOUT);
    s.setSoTimeout(60000);
    s.setDefaultMaxConnectionsPerHost(100);
    s.setMaxTotalConnections(100);
    return s;
  } catch (Exception ex) {
    throw new RuntimeException(ex);
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:17,代码来源:AbstractFullDistribZkTestBase.java

示例7: getSolrServer

import org.apache.solr.client.solrj.impl.HttpSolrServer; //导入方法依赖的package包/类
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;
}
 
开发者ID:lafourchette,项目名称:solrmeter,代码行数:20,代码来源:SolrServerRegistry.java

示例8: getNewHttpSolrServer

import org.apache.solr.client.solrj.impl.HttpSolrServer; //导入方法依赖的package包/类
public static HttpSolrServer getNewHttpSolrServer(String confFilename) throws FatalIndexerException {
    HttpSolrServer server = new HttpSolrServer(Configuration.getInstance(confFilename).getConfiguration("solrUrl"));
    server.setSoTimeout(TIMEOUT_SO); // socket read timeout
    server.setConnectionTimeout(TIMEOUT_CONNECTION);
    server.setDefaultMaxConnectionsPerHost(100);
    server.setMaxTotalConnections(100);
    server.setFollowRedirects(false); // defaults to false
    server.setAllowCompression(true);
    server.setMaxRetries(1); // defaults to 0. > 1 not recommended.
    // server.setParser(new XMLResponseParser()); // binary parser is used by default
    server.setRequestWriter(new BinaryRequestWriter());

    return server;
}
 
开发者ID:intranda,项目名称:goobi-viewer-indexer,代码行数:15,代码来源:SolrHelper.java

示例9: createServer

import org.apache.solr.client.solrj.impl.HttpSolrServer; //导入方法依赖的package包/类
protected SolrServer createServer( String name )
{
  try {
    // setup the server...
    String url = buildUrl(port, context) + "/" + name;
    HttpSolrServer s = new HttpSolrServer( url );
    s.setConnectionTimeout(SolrTestCaseJ4.DEFAULT_CONNECTION_TIMEOUT);
    s.setDefaultMaxConnectionsPerHost(100);
    s.setMaxTotalConnections(100);
    return s;
  }
  catch( Exception ex ) {
    throw new RuntimeException( ex );
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:16,代码来源:MultiCoreExampleJettyTest.java

示例10: createNewSolrServer

import org.apache.solr.client.solrj.impl.HttpSolrServer; //导入方法依赖的package包/类
protected SolrServer createNewSolrServer(int port) {
  try {
    // setup the server...
    HttpSolrServer s = new HttpSolrServer(buildUrl(port));
    s.setConnectionTimeout(DEFAULT_CONNECTION_TIMEOUT);
    s.setSoTimeout(90000);
    s.setDefaultMaxConnectionsPerHost(100);
    s.setMaxTotalConnections(100);
    return s;
  }
  catch (Exception ex) {
    throw new RuntimeException(ex);
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:15,代码来源:BaseDistributedSearchTestCase.java

示例11: createNewSolrServer

import org.apache.solr.client.solrj.impl.HttpSolrServer; //导入方法依赖的package包/类
private static SolrServer createNewSolrServer(int port) {
  try {
    // setup the server...
    HttpSolrServer s = new HttpSolrServer(buildUrl(port));
    s.setConnectionTimeout(15000);
    s.setSoTimeout(60000);
    s.setDefaultMaxConnectionsPerHost(100);
    s.setMaxTotalConnections(100);
    return s;
  }
  catch (Exception ex) {
    throw new RuntimeException(ex);
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:15,代码来源:TestReplicationHandler.java

示例12: createNewSolrServer

import org.apache.solr.client.solrj.impl.HttpSolrServer; //导入方法依赖的package包/类
private static SolrServer createNewSolrServer(int port) {
  try {
    // setup the server...
    HttpSolrServer s = new HttpSolrServer(buildUrl(port, context));
    s.setConnectionTimeout(15000);
    s.setSoTimeout(60000);
    s.setDefaultMaxConnectionsPerHost(100);
    s.setMaxTotalConnections(100);
    return s;
  }
  catch (Exception ex) {
    throw new RuntimeException(ex);
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:15,代码来源:TestReplicationHandlerBackup.java

示例13: createNewSolrServer

import org.apache.solr.client.solrj.impl.HttpSolrServer; //导入方法依赖的package包/类
protected SolrServer createNewSolrServer(String collection, String baseUrl) {
  try {
    // setup the server...
    HttpSolrServer s = new HttpSolrServer(baseUrl + "/" + collection);
    s.setSoTimeout(120000);
    s.setDefaultMaxConnectionsPerHost(100);
    s.setMaxTotalConnections(100);
    return s;
  }
  catch (Exception ex) {
    throw new RuntimeException(ex);
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:14,代码来源:BasicDistributedZkTest.java


注:本文中的org.apache.solr.client.solrj.impl.HttpSolrServer.setMaxTotalConnections方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。