package ctbrec;

import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;

@Slf4j
public class GlobalThreadPool {

    private static final ExecutorService threadPool = Executors.newWorkStealingPool();

    private GlobalThreadPool() {
    }

    public static Future<?> submit(Runnable runnable) { // NOSONAR
        return threadPool.submit(runnable);
    }

    public static <T> Future<T> submit(Callable<T> callable) {
        return threadPool.submit(callable);
    }

    public static ExecutorService get() {
        return threadPool;
    }
}
