Javatpoint Logo
Javatpoint Logo

Java ThreadPoolExecutor allowCoreThreadTimeOut() Method

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

Syntax

Parameters

value - true if should time out, else false

Return

Does not have a return value.

Throw

IllegalArgumentException

Example 1

Test it Now

Output:

allowCoreThreadTimeOut  is already true
In Runnable!

Example 2

Test it Now

Output:

creating service
a and b=4:0






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