package com.sy.coinage.core.util;

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

public class ThreadPoolUtil {
    private static final ExecutorService executor = Executors.newFixedThreadPool(20);

    public ThreadPoolUtil() {
    }

    public ExecutorService getExecutor() {
        return executor;
    }

    public static void submitRunnable(Runnable runnable) {
        executor.submit(runnable);
    }

    public static <V> Future submitCallable(Callable<V> callable) {
        Future<V> submit = executor.submit(callable);
        return submit;
    }
}
