Java ThreadPoolExecutor purge() MethodThe purge() method of ThreadPoolExecutor class tries to remove from the work queue all Future tasks that have been canceled. SyntaxParametersNA ReturnsDoes not return value. ThrowDoes not throw an exception. Example 1Test it NowOutput: Running Thread Name: pool-1-thread-2 Running Thread Name: pool-1-thread-1 Completed Thread Name: pool-1-thread-1 Completed Thread Name: pool-1-thread-2 Example 2Test it NowOutput: Starting threads i=5 i=5
Next TopicJava ThreadPoolExecutor
|