Javatpoint Logo
Javatpoint Logo

Java ThreadPoolExecutor isTerminating() Method

The isTerminating() method of ThreadPoolExcutor class returns true if this executor is in the process of terminating after shutdown() or shutdownNow() but has not completely terminated.

Syntax

Parameters

No parameter is passed.

Return

True if terminating but not yet terminated

Throw

Does not throw exception.

Example 1

Test it Now

Output:

get Task count after:2
 Is Executor is Terminating :true
Running Thread Name: pool-1-thread-2
Running Thread Name: pool-1-thread-1
Completed Thread Name: pool-1-thread-2
Completed Thread Name: pool-1-thread-1

Example 2

Test it Now

Output:

Starting threads
Maximum pool size: 2147483647
get Task count before:0
get Task count after:2
i=5
 Is Executor is Terminated :true
Threads started, main ends
i=5






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