com.algolia.utils.ExecutorUtils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of algoliasearch Show documentation
Show all versions of algoliasearch Show documentation
Java client for Algolia Search API
The newest version!
package com.algolia.utils;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.SynchronousQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
public class ExecutorUtils {
private ExecutorUtils() {
// Empty.
}
private static final String THREAD_NAME = "algolia-worker";
public static ExecutorService newThreadPool() {
return new ThreadPoolExecutor(0, Integer.MAX_VALUE, 60, TimeUnit.SECONDS, new SynchronousQueue<>(), runnable -> {
Thread thread = new Thread(runnable, THREAD_NAME);
thread.setDaemon(false);
return thread;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy