標籤:style http io ar 使用 java for sp div
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類的代碼,我是覺得不錯,就拿來使用了 http://dev.eclipse.org/svnroot/rt/org.eclipse.smila/trunk/core/org.eclipse.smila.solr/code/src/org/eclipse/smila/solr/SolrManager.java發連結,不貼代碼了,沒有格式,太難看了 http://dev.eclipse.org/svnroot/rt/org.eclipse.smila/trunk/core/ 這個連結裡的東西都是寶物哦,趕緊行動吧! 一個簡單問答stackoverflow - Solr - instantiate HttpSolrServer with Httpclient
HttpSolrServer 執行個體管理參考,來自org.eclipse.smila.solr