From ba793a32c037fa7433e52c39349a4536f3b25fd5 Mon Sep 17 00:00:00 2001 From: Michael Peter Christen Date: Thu, 30 May 2013 12:39:28 +0200 Subject: [PATCH] added timeout for remote searches of 10 seconds --- .../net/yacy/cora/federate/solr/instance/RemoteInstance.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/source/net/yacy/cora/federate/solr/instance/RemoteInstance.java b/source/net/yacy/cora/federate/solr/instance/RemoteInstance.java index e590191ca..62024a5f5 100644 --- a/source/net/yacy/cora/federate/solr/instance/RemoteInstance.java +++ b/source/net/yacy/cora/federate/solr/instance/RemoteInstance.java @@ -53,6 +53,8 @@ import org.apache.http.impl.client.BasicCredentialsProvider; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.impl.client.DefaultHttpRequestRetryHandler; import org.apache.http.impl.conn.PoolingClientConnectionManager; +import org.apache.http.params.HttpConnectionParams; +import org.apache.http.params.HttpParams; import org.apache.http.protocol.HttpContext; import org.apache.solr.client.solrj.SolrServer; import org.apache.solr.client.solrj.impl.HttpSolrServer; @@ -145,6 +147,9 @@ public class RemoteInstance implements SolrInstance { return context; } }; + HttpParams params = this.client.getParams(); + HttpConnectionParams.setConnectionTimeout(params, 10000); + HttpConnectionParams.setSoTimeout(params, 10000); this.client.addRequestInterceptor(new HttpRequestInterceptor() { @Override public void process(final HttpRequest request, final HttpContext context) throws IOException {