首页 > Web开发 > 详细

HttpSolrServer 实例管理参考,来自org.eclipse.smila.solr

时间:2014-11-05 10:30:22      阅读:403      评论:0      收藏:0      [点我收藏+]
http://dev.eclipse.org/svnroot/rt/org.eclipse.smila/trunk/core/org.eclipse.smila.solr/code/为什么要对实例管理?看看wiki文档说明就知道了。
 
  /*
    HttpSolrServer is thread-safe and if you are using the following constructor,
    you *MUST* re-use the same instance for all requests.  If instances are created on
    the fly, it can cause a connection leak. The recommended practice is to keep a
    static instance of HttpSolrServer per solr server url and share it for all requests.
    See https://issues.apache.org/jira/browse/SOLR-861 for more details
  */
 
goole翻译,我理解的大概意思是:HttpSolrServer是线程安全的,保持每台Solr服务器的的URL HttpSolrServer静态实例能防止连接泄漏,性能也有提升,节省了资源开销。
 
 
google上找来一个开源代码,虽然他们用的solr不是最新版4.0。但是模式可以借鉴。
看了这个SolrServer Manager类的代码,我是觉得不错,就拿来使用了
 
发链接,不贴代码了,没有格式,太难看了
 
 
 
这个链接里的东西都是宝物哦,赶紧行动吧!
 
 
一个简单问答

HttpSolrServer 实例管理参考,来自org.eclipse.smila.solr

原文:http://www.cnblogs.com/svennee/p/4075457.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!