Tabnine Logo
ExecutorUtil
Code IndexAdd Tabnine to your IDE (free)

How to use
ExecutorUtil
in
org.apache.solr.common.util

Best Java code snippets using org.apache.solr.common.util.ExecutorUtil (Showing top 20 results out of 315)

origin: org.apache.solr/solr-solrj

private void closeCallbackExecutor() {
 try {
  ExecutorUtil.shutdownAndAwaitTermination(zkCallbackExecutor);
 } catch (Exception e) {
  SolrException.log(log, e);
 }
 try {
  ExecutorUtil.shutdownAndAwaitTermination(zkConnManagerCallbackExecutor);
 } catch (Exception e) {
  SolrException.log(log, e);
 }
}
origin: org.apache.solr/solr-solrj

/**
 * Create a cached thread pool using a named thread factory
 */
public static ExecutorService newMDCAwareCachedThreadPool(String name) {
 return newMDCAwareCachedThreadPool(new SolrjNamedThreadFactory(name));
}
origin: org.apache.solr/solr-solrj

public static void shutdownAndAwaitTermination(ExecutorService pool) {
 pool.shutdown(); // Disable new tasks from being submitted
 awaitTermination(pool);
}
origin: org.apache.solr/solr-solrj

public void open() throws IOException {
 executorService = ExecutorUtil.newMDCAwareFixedThreadPool(threads, new SolrjNamedThreadFactory("ExecutorStream"));
 stream.open();
}
origin: com.hynnet/solr-solrj

/**
 * @lucene.experimental
 */
public HttpUriRequestResponse httpUriRequest(final SolrRequest request, final ResponseParser processor) throws SolrServerException, IOException {
 HttpUriRequestResponse mrr = new HttpUriRequestResponse();
 final HttpRequestBase method = createMethod(request, null);
 ExecutorService pool = ExecutorUtil.newMDCAwareFixedThreadPool(1, new SolrjNamedThreadFactory("httpUriRequest"));
 try {
  MDC.put("HttpSolrClient.url", baseUrl);
  mrr.future = pool.submit(new Callable<NamedList<Object>>(){
   @Override
   public NamedList<Object> call() throws Exception {
    return executeMethod(method, processor);
   }});
 } finally {
  pool.shutdown();
  MDC.remove("HttpSolrClient.url");
 }
 assert method != null;
 mrr.httpUriRequest = method;
 return mrr;
}
origin: org.apache.solr/solr-solrj

public void close() {
 this.closed  = true;
 notifications.shutdown();
 ExecutorUtil.shutdownAndAwaitTermination(collectionPropsNotifications);
 if (closeClient) {
  zkClient.close();
 }
}

origin: com.hynnet/solr-solrj

public ConcurrentUpdateSolrClient(String solrServerUrl,
                 HttpClient client, int queueSize, int threadCount) {
 this(solrServerUrl, client, queueSize, threadCount, ExecutorUtil.newMDCAwareCachedThreadPool(
   new SolrjNamedThreadFactory("concurrentUpdateScheduler")));
 shutdownExecutor = true;
}
origin: org.apache.solr/solr-solrj

/**
 * @lucene.experimental
 */
public HttpUriRequestResponse httpUriRequest(final SolrRequest request, final ResponseParser processor) throws SolrServerException, IOException {
 HttpUriRequestResponse mrr = new HttpUriRequestResponse();
 final HttpRequestBase method = createMethod(request, null);
 ExecutorService pool = ExecutorUtil.newMDCAwareFixedThreadPool(1, new SolrjNamedThreadFactory("httpUriRequest"));
 try {
  MDC.put("HttpSolrClient.url", baseUrl);
  mrr.future = pool.submit(() -> executeMethod(method, processor, isV2ApiRequest(request)));
 } finally {
  pool.shutdown();
  MDC.remove("HttpSolrClient.url");
 }
 assert method != null;
 mrr.httpUriRequest = method;
 return mrr;
}
origin: com.hynnet/solr-solrj

private void closeCallbackExecutor() {
 try {
  ExecutorUtil.shutdownAndAwaitTermination(zkCallbackExecutor);
 } catch (Exception e) {
  SolrException.log(log, e);
 }
}
origin: org.apache.solr/solr-solrj

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();
 }
}
origin: org.apache.solr/solr-solrj

threadPool = ExecutorUtil.newMDCAwareFixedThreadPool(threads, new SolrjNamedThreadFactory("ShortestPathStream"));
origin: org.apache.solr/solr-solrj

public static void tryClose() {
 Set<Entry<Object,String>> entries = OBJECTS.entrySet();
 if (entries.size() > 0) {
  for (Entry<Object,String> entry : entries) {
   if (entry.getKey() instanceof Closeable) {
    try {
     ((Closeable)entry.getKey()).close();
    } catch (Throwable t) {
     log.error("", t);
    }
   } else if (entry.getKey() instanceof ExecutorService) {
    try {
     ExecutorUtil.shutdownAndAwaitTermination((ExecutorService)entry.getKey());
    } catch (Throwable t) {
     log.error("", t);
    }
   }
  }
 }
}

origin: org.apache.solr/solr-solrj

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();
 }
}
origin: org.apache.solr/solr-solrj

threadPool = ExecutorUtil.newMDCAwareFixedThreadPool(4, new SolrjNamedThreadFactory("GatherNodesStream"));
origin: org.apache.solr/solr-test-framework

ExecutorUtil.shutdownAndAwaitTermination(executorLauncher);
ExecutorUtil.shutdownAndAwaitTermination(executorCloser);
try {
 if (!externalZkServer) {
origin: com.hynnet/solr-solrj

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();
 }
}
origin: com.ngdata/hbase-indexer-mr

 return true;
} finally {
 ExecutorUtil.shutdownAndAwaitTermination(executor);
 float secs = (System.nanoTime() - start) / (float)(1.0e9);
 LOG.info("Live merging of index shards into Solr cluster took " + secs + " secs");
origin: org.apache.solr/solr-solrj

public void open() throws IOException {
 if (cache == null) {
  isCloseCache = true;
  cache = new SolrClientCache();
 } else {
  isCloseCache = false;
 }
 this.executorService = ExecutorUtil.newMDCAwareCachedThreadPool(new SolrjNamedThreadFactory("SignificantTermsStream"));
}
origin: com.cloudera.search/search-mr

 return true;
} finally {
 ExecutorUtil.shutdownAndAwaitTermination(executor);
 float secs = (System.nanoTime() - start) / (float)(1.0e9);
 LOG.info("Live merging of index shards into Solr cluster took " + secs + " secs");
origin: org.apache.solr/solr-solrj

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();
 }
}
org.apache.solr.common.utilExecutorUtil

Most used methods

  • shutdownAndAwaitTermination
  • newMDCAwareCachedThreadPool
    See java.util.concurrent.Executors#newCachedThreadPool(ThreadFactory)
  • newMDCAwareFixedThreadPool
    See java.util.concurrent.Executors#newFixedThreadPool(int,ThreadFactory)
  • awaitTermination

Popular in Java

  • Running tasks concurrently on multiple threads
  • getSharedPreferences (Context)
  • requestLocationUpdates (LocationManager)
  • getApplicationContext (Context)
  • Graphics2D (java.awt)
    This Graphics2D class extends the Graphics class to provide more sophisticated control overgraphics
  • Permission (java.security)
    Legacy security code; do not use.
  • Format (java.text)
    The base class for all formats. This is an abstract base class which specifies the protocol for clas
  • Scanner (java.util)
    A parser that parses a text string of primitive types and strings with the help of regular expressio
  • TimeZone (java.util)
    TimeZone represents a time zone offset, and also figures out daylight savings. Typically, you get a
  • Loader (org.hibernate.loader)
    Abstract superclass of object loading (and querying) strategies. This class implements useful common
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now