From the course: Java EE: Concurrency and Multithreading

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

ThreadFactory API

ThreadFactory API

From the course: Java EE: Concurrency and Multithreading

Start my 1-month free trial

ThreadFactory API

- [Instructor] Now let's talk about the ThreadFactory API. Executor API by default uses a Thread factory implementation present inside it to create threads for the application. Let's recollect our discussion. Let me open the Test Executors class and if you recollect our discussion on line number 30, we had used this factory method, new Fixed Thread Pool in order to get the Executor Service object. Now, since you have not mentioned any kind of Thread factory reference here, by default it is falling back to the default implementation on Thread factory. So, the Thread factory's going to manufacture threads and insert them into the pool and those threads are going to be reused. So, whenever you use the executor's default Thread factory implementation, it will create threads for you, all of which are in the same thread group with the same non-priority priority. Non-priority is basically number five and a non-demand stasis. And whenever you have used the fixed thread pool, or let's say, the…

Contents