close the request we created

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1023520 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Yonik Seeley 2010-10-17 16:28:37 +00:00
parent 05d93646cc
commit d656ba9873
1 changed files with 7 additions and 5 deletions

View File

@ -23,6 +23,7 @@ import org.apache.solr.common.params.SolrParams;
import org.apache.solr.common.util.NamedList;
import org.apache.solr.common.util.XML;
import org.apache.solr.core.SolrCore;
import org.apache.solr.request.LocalSolrQueryRequest;
import org.apache.solr.request.SolrQueryRequest;
import org.apache.solr.request.SolrQueryRequestBase;
import org.apache.solr.response.SolrQueryResponse;
@ -117,15 +118,13 @@ public class XmlUpdateRequestHandler extends ContentStreamHandlerBase {
*/
@Deprecated
public void doLegacyUpdate(Reader input, Writer output) {
try {
SolrCore core = SolrCore.getSolrCore();
SolrCore core = SolrCore.getSolrCore();
SolrQueryRequest req = new LocalSolrQueryRequest(core, new HashMap<String,String[]>());
try {
// Old style requests do not choose a custom handler
UpdateRequestProcessorChain processorFactory = core.getUpdateProcessingChain(null);
SolrParams params = new MapSolrParams(new HashMap<String, String>());
SolrQueryRequestBase req = new SolrQueryRequestBase(core, params) {
};
SolrQueryResponse rsp = new SolrQueryResponse(); // ignored
XMLStreamReader parser = inputFactory.createXMLStreamReader(input);
UpdateRequestProcessor processor = processorFactory.createProcessor(req, rsp);
@ -142,6 +141,9 @@ public class XmlUpdateRequestHandler extends ContentStreamHandlerBase {
log.error("Error writing to output stream: " + ee);
}
}
finally {
req.close();
}
}
//////////////////////// SolrInfoMBeans methods //////////////////////