package hozza.network.security.threading.database;

import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadPoolExecutor;

public class TwitchCronThreadManager
{
    private ThreadPoolExecutor mariaThreadPoolExecutor = null;

    public void invokeCallableList(List<Callable<Boolean>> taskList)
    {
        if(this.mariaThreadPoolExecutor != null)
        {
            return;
        }

        this.mariaThreadPoolExecutor = (ThreadPoolExecutor)Executors.newFixedThreadPool(100, new TwitchCronThreadFactory());
        try 
        {
            this.mariaThreadPoolExecutor.invokeAll(taskList);
        } 
        catch (InterruptedException ignored)
        {

        }
        this.mariaThreadPoolExecutor.shutdown();
        this.mariaThreadPoolExecutor = null;
    }
}
