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

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

Introduction

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

Prototype

@Deprecated
public void setSoTimeout(int timeout) 

Source Link

Document

set soTimeout (read timeout) on the underlying HttpConnectionManager.

Usage

From source file:org.dbflute.solr.bhv.AbstractSolrBehavior.java

License:Apache License

/**
 * Create LBHttpSolrClient associated with the assigned list of URLs.
 * @param urlList List of URL (NotNull)/*from   w  ww  .  jav  a2s  . c  om*/
 * @return LBHttpSolrClient (NotNull)
 */
protected LBHttpSolrClient createLBHttpSolrClient(List<String> urlList) {
    LBHttpSolrClient client;
    try {
        client = new LBHttpSolrClient(urlList.toArray(new String[] {}));
    } catch (MalformedURLException e) {
        throw new SolrException("Failed to create Select Solr Client", e);
    }
    client.setConnectionTimeout(getConnectionTimeout());
    client.setSoTimeout(getSocketTimeout());
    client.setAliveCheckInterval(getAliveCheckInterval());
    adjustHttpClient(client.getHttpClient());
    return client;
}

From source file:org.seedstack.solr.internal.SolrPlugin.java

License:Mozilla Public License

private SolrClient buildLBSolrClient(Configuration solrClientConfiguration, String[] lbUrls)
        throws MalformedURLException {
    LBHttpSolrClient lbHttpSolrClient = new LBHttpSolrClient(lbUrls);

    if (solrClientConfiguration.containsKey(SolrConfigurationConstants.CONNECTION_TIMEOUT)) {
        lbHttpSolrClient.setConnectionTimeout(
                solrClientConfiguration.getInt(SolrConfigurationConstants.CONNECTION_TIMEOUT));
    }//from  w w  w  . j ava2s  .  c om

    if (solrClientConfiguration.containsKey(SolrConfigurationConstants.ALIVE_CHECK_INTERVAL)) {
        lbHttpSolrClient.setAliveCheckInterval(
                solrClientConfiguration.getInt(SolrConfigurationConstants.ALIVE_CHECK_INTERVAL));
    }

    if (solrClientConfiguration.containsKey(SolrConfigurationConstants.QUERY_PARAMS)) {
        lbHttpSolrClient.setQueryParams(Sets
                .newHashSet(solrClientConfiguration.getStringArray(SolrConfigurationConstants.QUERY_PARAMS)));
    }

    if (solrClientConfiguration.containsKey(SolrConfigurationConstants.SO_TIMEOUT)) {
        lbHttpSolrClient.setSoTimeout(solrClientConfiguration.getInt(SolrConfigurationConstants.SO_TIMEOUT));
    }

    return lbHttpSolrClient;
}