package J20250804.demo02;

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

/**
 * @author WanJl
 * @version 1.0
 * @title Main
 * @description
 * @create 2025/8/4
 */
public class Main {
    public static void main(String[] args) {
        ExecutorService executorService = Executors.newFixedThreadPool(3);
        BlockingQueue<String> queue=new LinkedBlockingQueue<>();
        //启动生产者
        executorService.submit(new Producer("input.txt",queue));
        //启动消费者
        executorService.submit(new Consumer("even.txt",queue,true));
        executorService.submit(new Consumer("odd.txt",queue,false));

        executorService.shutdown();

    }
}
