mirror of https://github.com/apache/lucene.git
SOLR-4266: HttpSolrServer does not release connection properly on exception when no response parser is used.
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1434109 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
8a23ab7cfd
commit
d776712255
solr
|
@ -562,6 +562,9 @@ Bug Fixes
|
|||
|
||||
* SOLR-4303: On replication, if the generation of the master is lower than the
|
||||
slave we need to force a full copy of the index. (Mark Miller, Gregg Donovan)
|
||||
|
||||
* SOLR-4266: HttpSolrServer does not release connection properly on exception
|
||||
when no response parser is used. (Steve Molloy via Mark Miller)
|
||||
|
||||
Other Changes
|
||||
----------------------
|
||||
|
|
|
@ -346,6 +346,7 @@ public class HttpSolrServer extends SolrServer {
|
|||
method.addHeader("User-Agent", AGENT);
|
||||
|
||||
InputStream respBody = null;
|
||||
boolean shouldClose = true;
|
||||
|
||||
try {
|
||||
// Execute the method.
|
||||
|
@ -378,6 +379,8 @@ public class HttpSolrServer extends SolrServer {
|
|||
// no processor specified, return raw stream
|
||||
NamedList<Object> rsp = new NamedList<Object>();
|
||||
rsp.add("stream", respBody);
|
||||
// Only case where stream should not be closed
|
||||
shouldClose = false;
|
||||
return rsp;
|
||||
}
|
||||
String charset = EntityUtils.getContentCharSet(response.getEntity());
|
||||
|
@ -413,7 +416,7 @@ public class HttpSolrServer extends SolrServer {
|
|||
throw new SolrServerException(
|
||||
"IOException occured when talking to server at: " + getBaseURL(), e);
|
||||
} finally {
|
||||
if (respBody != null && processor!=null) {
|
||||
if (respBody != null && shouldClose) {
|
||||
try {
|
||||
respBody.close();
|
||||
} catch (Throwable t) {} // ignore
|
||||
|
|
Loading…
Reference in New Issue