mirror of https://github.com/apache/lucene.git
close request in DirectSolrConnection
git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@632541 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
dd622ea5f5
commit
0148a9cee6
|
@ -157,18 +157,25 @@ public class DirectSolrConnection
|
|||
streams.add( new ContentStreamBase.StringStream( body ) );
|
||||
}
|
||||
|
||||
SolrQueryRequest req = parser.buildRequestFrom( core, params, streams );
|
||||
SolrQueryResponse rsp = new SolrQueryResponse();
|
||||
core.execute( handler, req, rsp );
|
||||
if( rsp.getException() != null ) {
|
||||
throw rsp.getException();
|
||||
SolrQueryRequest req = null;
|
||||
try {
|
||||
req = parser.buildRequestFrom( core, params, streams );
|
||||
SolrQueryResponse rsp = new SolrQueryResponse();
|
||||
core.execute( handler, req, rsp );
|
||||
if( rsp.getException() != null ) {
|
||||
throw rsp.getException();
|
||||
}
|
||||
|
||||
// Now write it out
|
||||
QueryResponseWriter responseWriter = core.getQueryResponseWriter(req);
|
||||
StringWriter out = new StringWriter();
|
||||
responseWriter.write(out, req, rsp);
|
||||
return out.toString();
|
||||
} finally {
|
||||
if (req != null) {
|
||||
req.close();
|
||||
}
|
||||
}
|
||||
|
||||
// Now write it out
|
||||
QueryResponseWriter responseWriter = core.getQueryResponseWriter(req);
|
||||
StringWriter out = new StringWriter();
|
||||
responseWriter.write(out, req, rsp);
|
||||
return out.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue