Online Java Compiler By
JavaTpoint.com
import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ThreadFactory; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; public class ExecutorsnewSheduledThreadPoollExample2 { public static void main(final String[] arguments) throws InterruptedException { ScheduledExecutorService scheduler = Executors.newScheduledThreadPool( 3 ); ThreadFactory ThreadFactory = Executors.defaultThreadFactory(); System.out.println(scheduler.getClass()); ExecutorService excr = Executors.newCachedThreadPool(ThreadFactory); ThreadPoolExecutor mypool = (ThreadPoolExecutor) excr; System.out.println("size of mypool: " + mypool.getPoolSize()); System.out.println(scheduler.isShutdown()); System.out.println(scheduler.getClass()); excr.shutdown(); } }
Output