HttpSolrServer 实例管理参考,来自org.eclipse.smila.solr
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了HttpSolrServer 实例管理参考,来自org.eclipse.smila.solr,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含1105字,纯文字阅读大概需要2分钟。
内容图文

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
*/
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类的代码,我是觉得不错,就拿来使用了
发链接,不贴代码了,没有格式,太难看了
这个链接里的东西都是宝物哦,赶紧行动吧!
一个简单问答
原文:http://www.cnblogs.com/svennee/p/4075457.html
内容总结
以上是互联网集市为您收集整理的HttpSolrServer 实例管理参考,来自org.eclipse.smila.solr全部内容,希望文章能够帮你解决HttpSolrServer 实例管理参考,来自org.eclipse.smila.solr所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。
来源:【匿名】