image.png

    1. static ThreadPoolExecutor threadPoolExecutor;
    2. public static void main(String[] args){
    3. threadPoolExecutor = new ThreadPoolExecutor(0,100,
    4. 3, TimeUnit.SECONDS,
    5. new ArrayBlockingQueue<>(98));
    6. for (int i = 0; i <3; i++) {
    7. threadPoolExecutor.execute(() -> {
    8. log.debug("worker thread size[{}]", threadPoolExecutor.getPoolSize());
    9. });
    10. }
    11. }