Java ThreadPoolExecutor isShutdown() MethodThe isShutdown() of ThreadPoolExecutor class returns true if this executor has been shut down otherwise it returns false. SyntaxParametersNo parameter is passed. ReturnIt returns true if this executor has been shut down ThrowDoes not throw the exception. Example 1Test it NowOutput: Is Executor is shutdown :false get Task count after:2 Is Executor is shutdown :true Running Thread Name: pool-1-thread-1 Running Thread Name: pool-1-thread-2 Completed Thread Name: pool-1-thread-2 Completed Thread Name: pool-1-thread-1 Example 2Test it NowOutput: Starting threads Maximum pool size: 2147483647 get Task count before:0 Is Executor is shutdown :false i=5 get Task count after:2 Is Executor is shutdown :true Threads started, main ends i=5
Next TopicJava ThreadPoolExecutor
|