package com.face.global;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

public class GlobalThreadPool {
    public static final ThreadPoolExecutor SMALL_THREAD_POOL_ABORT =
            new ThreadPoolExecutor(5, 10,
                    60, TimeUnit.SECONDS, new ArrayBlockingQueue<>(200),
                    new ThreadPoolExecutor.AbortPolicy());

    public static final ThreadPoolExecutor IO_THREAD_POOL_CALL_RUN =
            new ThreadPoolExecutor(Runtime.getRuntime().availableProcessors(),
                    Runtime.getRuntime().availableProcessors() * 2,
                    60, TimeUnit.SECONDS, new ArrayBlockingQueue<>(200),
                    new ThreadPoolExecutor.CallerRunsPolicy());


    public static final ThreadPoolExecutor IO_THREAD_POOL_ABORT =
            new ThreadPoolExecutor(Runtime.getRuntime().availableProcessors(),
                    Runtime.getRuntime().availableProcessors() * 2,
                    60, TimeUnit.SECONDS, new ArrayBlockingQueue<>(200),
                    new ThreadPoolExecutor.AbortPolicy());
}
