Javatpoint Logo
Javatpoint Logo

Java ThreadPoolExecutor afterExecute() Method

The afterExecute() method of ThreadPoolExecutor class is invoked after execution of the given Runnable. This method is invoked by the same thread that executed the task.

Syntax

Parameters

r - the runnable that has completed

t - the exception that caused termination, or null if execution completed normally

Return value

NA

Throw

RuntimeException.

Example 1

Test it Now

Output:

In Runnable!
Completed!! without any Exception

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