From 5d1f619f0794f48228f93dafbdf87f3f3313b5c5 Mon Sep 17 00:00:00 2001 From: sixcooler Date: Fri, 28 Jun 2013 15:19:50 +0200 Subject: [PATCH] possible helpful closing of solr-requests --- htroot/gsa/searchresult.java | 6 +++++- htroot/solr/select.java | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/htroot/gsa/searchresult.java b/htroot/gsa/searchresult.java index 9a2450260..0aa56eb0f 100644 --- a/htroot/gsa/searchresult.java +++ b/htroot/gsa/searchresult.java @@ -44,6 +44,7 @@ import net.yacy.server.serverSwitch; import org.apache.solr.common.SolrException; import org.apache.solr.common.params.CommonParams; import org.apache.solr.request.SolrQueryRequest; +import org.apache.solr.request.SolrRequestInfo; import org.apache.solr.response.ResultContext; import org.apache.solr.response.SolrQueryResponse; import org.apache.solr.util.FastWriter; @@ -189,6 +190,8 @@ public class searchresult { if (response != null) e = response.getException(); if (e != null) { Log.logException(e); + if (req != null) req.close(); + SolrRequestInfo.clearRequestInfo(); return null; } @@ -211,6 +214,7 @@ public class searchresult { } catch (IOException e1) { } finally { req.close(); + SolrRequestInfo.clearRequestInfo(); try {ow.close();} catch (IOException e1) {} } @@ -221,4 +225,4 @@ public class searchresult { } return null; } -} \ No newline at end of file +} diff --git a/htroot/solr/select.java b/htroot/solr/select.java index 906629967..2451e0b95 100644 --- a/htroot/solr/select.java +++ b/htroot/solr/select.java @@ -57,6 +57,7 @@ import org.apache.solr.common.params.SolrParams; import org.apache.solr.common.util.NamedList; import org.apache.solr.core.SolrCore; import org.apache.solr.request.SolrQueryRequest; +import org.apache.solr.request.SolrRequestInfo; import org.apache.solr.response.QueryResponseWriter; import org.apache.solr.response.ResultContext; import org.apache.solr.response.SolrQueryResponse; @@ -221,6 +222,8 @@ public class select { if (response != null) e = response.getException(); if (e != null) { Log.logException(e); + if (req != null) req.close(); + SolrRequestInfo.clearRequestInfo(); return null; } @@ -232,6 +235,7 @@ public class select { } catch (IOException e1) { } finally { req.close(); + SolrRequestInfo.clearRequestInfo(); try {ow.close();} catch (IOException e1) {} }