Example usage for org.apache.solr.client.solrj.impl ConcurrentUpdateSolrClient setSoTimeout

List of usage examples for org.apache.solr.client.solrj.impl ConcurrentUpdateSolrClient setSoTimeout

Introduction

In this page you can find the example usage for org.apache.solr.client.solrj.impl ConcurrentUpdateSolrClient setSoTimeout.

Prototype

@Deprecated
public void setSoTimeout(int timeout) 

Source Link

Document

set soTimeout (read timeout) on the underlying HttpConnectionManager.

Usage

From source file:net.yacy.cora.federate.solr.instance.RemoteInstance.java

License:Open Source License

@Override
public SolrClient getServer(String name) {
    // try to get the server from the cache
    ConcurrentUpdateSolrClient s = this.server.get(name);
    if (s != null)
        return s;
    // create new http server
    if (this.client != null) {
        final MultiProtocolURL u;
        try {/*w w w.  ja v a 2  s. co m*/
            u = new MultiProtocolURL(this.solrurl + name);
        } catch (final MalformedURLException e) {
            return null;
        }
        String host = u.getHost();
        int port = u.getPort();
        String solrpath = u.getPath();
        String p = "http://" + host + ":" + port + solrpath;
        ConcurrentLog.info("RemoteSolrConnector", "connecting Solr authenticated with url:" + p);
        s = new ConcurrentUpdateSolrClient(p, ((org.apache.http.impl.client.DefaultHttpClient) this.client), 10,
                Runtime.getRuntime().availableProcessors());
    } else {
        ConcurrentLog.info("RemoteSolrConnector", "connecting Solr with url:" + this.solrurl + name);
        s = new ConcurrentUpdateSolrClient(this.solrurl + name, queueSizeByMemory(),
                Runtime.getRuntime().availableProcessors());
    }
    //s.setAllowCompression(true);
    s.setSoTimeout(this.timeout);
    //s.setMaxRetries(1); // Solr-Doc: No more than 1 recommended (depreciated)
    s.setSoTimeout(this.timeout);
    this.server.put(name, s);
    return s;
}