Search in sources :

Example 11 with SolrjNamedThreadFactory

use of org.apache.solr.common.util.SolrjNamedThreadFactory in project lucene-solr by apache.

the class SignificantTermsStream method open.

public void open() throws IOException {
    if (cache == null) {
        isCloseCache = true;
        cache = new SolrClientCache();
    } else {
        isCloseCache = false;
    }
    this.executorService = ExecutorUtil.newMDCAwareCachedThreadPool(new SolrjNamedThreadFactory("SignificantTermsStream"));
}
Also used : SolrjNamedThreadFactory(org.apache.solr.common.util.SolrjNamedThreadFactory) SolrClientCache(org.apache.solr.client.solrj.io.SolrClientCache)

Example 12 with SolrjNamedThreadFactory

use of org.apache.solr.common.util.SolrjNamedThreadFactory in project lucene-solr by apache.

the class CloudSolrStream method openStreams.

private void openStreams() throws IOException {
    ExecutorService service = ExecutorUtil.newMDCAwareCachedThreadPool(new SolrjNamedThreadFactory("CloudSolrStream"));
    try {
        List<Future<TupleWrapper>> futures = new ArrayList();
        for (TupleStream solrStream : solrStreams) {
            StreamOpener so = new StreamOpener((SolrStream) solrStream, comp);
            Future<TupleWrapper> future = service.submit(so);
            futures.add(future);
        }
        try {
            for (Future<TupleWrapper> f : futures) {
                TupleWrapper w = f.get();
                if (w != null) {
                    tuples.add(w);
                }
            }
        } catch (Exception e) {
            throw new IOException(e);
        }
    } finally {
        service.shutdown();
    }
}
Also used : ExecutorService(java.util.concurrent.ExecutorService) SolrjNamedThreadFactory(org.apache.solr.common.util.SolrjNamedThreadFactory) ArrayList(java.util.ArrayList) Future(java.util.concurrent.Future) IOException(java.io.IOException) IOException(java.io.IOException)

Aggregations

SolrjNamedThreadFactory (org.apache.solr.common.util.SolrjNamedThreadFactory)12 ExecutorService (java.util.concurrent.ExecutorService)8 IOException (java.io.IOException)4 ArrayList (java.util.ArrayList)4 Future (java.util.concurrent.Future)3 SolrClientCache (org.apache.solr.client.solrj.io.SolrClientCache)3 HashMap (java.util.HashMap)2 List (java.util.List)2 Map (java.util.Map)2 SolrQuery (org.apache.solr.client.solrj.SolrQuery)2 Tuple (org.apache.solr.client.solrj.io.Tuple)2 Test (org.junit.Test)2 HashSet (java.util.HashSet)1 Iterator (java.util.Iterator)1 LinkedList (java.util.LinkedList)1 Set (java.util.Set)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 HttpRequestBase (org.apache.http.client.methods.HttpRequestBase)1 CloseableHttpClient (org.apache.http.impl.client.CloseableHttpClient)1 PoolingHttpClientConnectionManager (org.apache.http.impl.conn.PoolingHttpClientConnectionManager)1