!7 !include #1011718 p { int poolSize = 4, queueSize = 10; int keepAliveSeconds = 15; // how long idle threads are kept alive NotifyingBlockingThreadPoolExecutor threadPoolExecutor = new(poolSize, queueSize, keepAliveSeconds, TimeUnit.SECONDS); for (int i = 0; i < 50; i++) { final int _i = i; threadPoolExecutor.execute(r { sleepSeconds(1); print(_i) }); } threadPoolExecutor.await(); }