![JAR search and dependency download from the Maven repository](/logo.png)
org.jgroups.util.jdkspecific.ThreadCreator Maven / Gradle / Ivy
Go to download
This artifact provides a single jar that contains all classes required to use remote Jakarta Enterprise Beans and Jakarta Messaging, including
all dependencies. It is intended for use by those not using maven, maven users should just import the Jakarta Enterprise Beans and
Jakarta Messaging BOM's instead (shaded JAR's cause lots of problems with maven, as it is very easy to inadvertently end up
with different versions on classes on the class path).
package org.jgroups.util.jdkspecific;
import org.jgroups.logging.Log;
import org.jgroups.util.ShutdownRejectedExecutionHandler;
import org.jgroups.util.ThreadFactory;
import org.jgroups.util.Util;
import java.util.concurrent.*;
public class ThreadCreator {
public static boolean hasVirtualThreads() {
return false;
}
public static Thread createThread(Runnable target, String name, boolean createDaemons, boolean ignored) {
Thread t=new Thread(target, name);
t.setDaemon(createDaemons);
return t;
}
public static ExecutorService createThreadPool(int min_threads,int max_threads,long keep_alive_time,
String rejection_policy,
BlockingQueue queue,final ThreadFactory factory,
boolean ignored, Log log) {
ThreadPoolExecutor pool = new ThreadPoolExecutor(min_threads, max_threads, keep_alive_time, TimeUnit.MILLISECONDS,
queue, factory);
RejectedExecutionHandler handler = Util.parseRejectionPolicy(rejection_policy);
pool.setRejectedExecutionHandler(new ShutdownRejectedExecutionHandler(handler));
log.debug("thread pool min/max/keep-alive (ms): %d/%d/%d", min_threads, max_threads, keep_alive_time);
return pool;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy