package com.muyu.parsing.manager;

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

/**
 * 线程配置
 */
public final class TaskManager {
    private final ExecutorService executorService;

    public TaskManager(int threadPoolSize) {
        this.executorService = Executors.newFixedThreadPool(threadPoolSize);
    }

    public void execute(Runnable task) {
        executorService.submit(task);
    }

    // 关闭线程池
    public void shutdown() {
        executorService.shutdown();
    }
}
