/** * Create a cached thread pool using a named thread factory */ public static ExecutorService newMDCAwareCachedThreadPool(String name) { return newMDCAwareCachedThreadPool(new SolrjNamedThreadFactory(name)); }
public ConcurrentUpdateSolrClient(String solrServerUrl, HttpClient client, int queueSize, int threadCount) { this(solrServerUrl, client, queueSize, threadCount, ExecutorUtil.newMDCAwareCachedThreadPool( new SolrjNamedThreadFactory("concurrentUpdateScheduler"))); shutdownExecutor = true; }
private void openStreams() throws IOException { ExecutorService service = ExecutorUtil.newMDCAwareCachedThreadPool(new SolrjNamedThreadFactory("TopicStream")); 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(); } }
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(); } }
public void open() throws IOException { if (cache == null) { isCloseCache = true; cache = new SolrClientCache(); } else { isCloseCache = false; } this.executorService = ExecutorUtil.newMDCAwareCachedThreadPool(new SolrjNamedThreadFactory("SignificantTermsStream")); }
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(); } }
protected ConcurrentUpdateSolrClient(Builder builder) { this.internalHttpClient = (builder.httpClient == null); this.client = new HttpSolrClient.Builder(builder.baseSolrUrl) .withHttpClient(builder.httpClient) .build(); this.client.setFollowRedirects(false); this.queue = new LinkedBlockingQueue<>(builder.queueSize); this.threadCount = builder.threadCount; this.runners = new LinkedList<>(); this.streamDeletes = builder.streamDeletes; this.connectionTimeout = builder.connectionTimeoutMillis; this.soTimeout = builder.socketTimeoutMillis; if (builder.executorService != null) { this.scheduler = builder.executorService; this.shutdownExecutor = false; } else { this.scheduler = ExecutorUtil.newMDCAwareCachedThreadPool(new SolrjNamedThreadFactory("concurrentUpdateScheduler")); this.shutdownExecutor = true; } if (log.isDebugEnabled()) { this.pollInterrupts = new AtomicInteger(); this.pollExits = new AtomicInteger(); this.blockLoops = new AtomicInteger(); this.emptyQueueLoops = new AtomicInteger(); } }
private void openStreams() throws IOException { ExecutorService service = ExecutorUtil.newMDCAwareCachedThreadPool(new SolrjNamedThreadFactory("ParallelListStream")); try { List<Future<StreamIndex>> futures = new ArrayList(); int i=0; for (TupleStream tupleStream : streams) { StreamOpener so = new StreamOpener(new StreamIndex(tupleStream, i++)); Future<StreamIndex> future = service.submit(so); futures.add(future); } try { for (Future<StreamIndex> f : futures) { StreamIndex streamIndex = f.get(); this.streams[streamIndex.getIndex()] = streamIndex.getTupleStream(); } } catch (Exception e) { throw new IOException(e); } } finally { service.shutdown(); } }
/** * Opens the CloudSolrStream * ***/ public void open() throws IOException { if (cache == null) { isCloseCache = true; cache = new SolrClientCache(); } else { isCloseCache = false; } this.cloudSolrClient = this.cache.getCloudSolrClient(zkHost); this.executorService = ExecutorUtil.newMDCAwareCachedThreadPool(new SolrjNamedThreadFactory("FeaturesSelectionStream")); }
/** * Opens the CloudSolrStream * ***/ public void open() throws IOException { if (cache == null) { isCloseCache = true; cache = new SolrClientCache(); } else { isCloseCache = false; } this.cloudSolrClient = this.cache.getCloudSolrClient(zkHost); this.executorService = ExecutorUtil.newMDCAwareCachedThreadPool(new SolrjNamedThreadFactory("TextLogitSolrStream")); }