Java ThreadPoolExecutor allowsCoreThreadTimeOut() MethodThe allowsCoreThreadTimeOut() method of ThreadPoolExecutor class returns true if this pool allows core threads to time out and terminate if no tasks arrive within the keepAlive time, being replaced if needed when new tasks arrive. SyntaxParametersTrue if core threads are allowed to time out, else false Return valueReturn Boolean. ThrowsDoes not throw the exception. Example 1Test it NowOutput: allowCoreThreadTimeOut is false In Runnable! Example 2Test it NowOutput: creating service Allowtimeout is set to false Welcome to main method
Next TopicJava ThreadPoolExecutor
|