Javatpoint Logo
Javatpoint Logo

Java ThreadPoolExecutor allowsCoreThreadTimeOut() Method

The 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.

Syntax

Parameters

True if core threads are allowed to time out, else false

Return value

Return Boolean.

Throws

Does not throw the exception.

Example 1

Test it Now

Output:

allowCoreThreadTimeOut  is  false
In Runnable!

Example 2

Test it Now

Output:

creating service
Allowtimeout is set to false
Welcome to main method






Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA