Java ThreadPoolExecutor allowCoreThreadTimeOut() MethodThe allowCoreThreadTimeOut() method of ThreadPoolExecutor class is used to set the policy which says that the core thread will terminate if no tasks arrive within the keep-alive time, being replaced if needed when new tasks arrive. SyntaxParametersvalue - true if should time out, else false ReturnDoes not have a return value. ThrowIllegalArgumentException Example 1Test it NowOutput: allowCoreThreadTimeOut is already true In Runnable! Example 2Test it NowOutput: creating service a and b=4:0
Next TopicJava ThreadPoolExecutor
|