@@ -0,0 +1,1443 @@
+package org.glamey.training.concurrent;%0A%0Aimport lombok.extern.slf4j.Slf4j;%0A%0Aimport java.util.concurrent.ExecutorService;%0Aimport java.util.concurrent.LinkedBlockingQueue;%0Aimport java.util.concurrent.ThreadPoolExecutor;%0Aimport java.util.concurrent.TimeUnit;%0A%0A/**%0A * http://ifeve.com/%25e4%25b8%2580%25e4%25b8%25aa%25e7%25ba%25bf%25e7%25a8%258b%25e7%25bd%25a2%25e5%25b7%25a5%25e7%259a%2584%25e8%25af%25a1%25e5%25bc%2582%25e4%25ba%258b%25e4%25bb%25b6/%0A *%0A * @author yang.zhou 2019.11.21.14%0A */%0A@Slf4j%0Apublic class ThreadWaitingError %7B%0A%0A    public static void main(String%5B%5D args) throws InterruptedException %7B%0A        ExecutorService executorService = new ThreadPoolExecutor(1, 1, 0L, TimeUnit.MILLISECONDS,%0A                new LinkedBlockingQueue%3C%3E());%0A%0A%0A        executorService.execute(() -%3E log.info(%22-----%3E %7B%7D%22, 1));%0A%0A%0A        TimeUnit.SECONDS.sleep(1);%0A%0A%0A        executorService.execute(new CustomRunnable());%0A%0A%0A    %7D%0A%0A%0A    private static class CustomRunnable implements Runnable %7B%0A        @Override%0A        public void run() %7B%0A            int count = 0;%0A            while (true) %7B%0A                count++;%0A                log.info(%22---%3E %7B%7D%22, count);%0A                if (count == 2) %7B%0A                    try %7B%0A                        log.info(%22---%3E %7B%7D %22, count / 0);%0A                    %7D catch (Exception e) %7B%0A                        e.printStackTrace();%0A                    %7D%0A                %7D%0A%0A                if (count == 3) %7B%0A                    break;%0A                %7D%0A            %7D%0A        %7D%0A    %7D%0A%7D%0A

test : singleThread waiting error