From the course: Advanced Java: Threads and Concurrency
Unlock the full course today
Join today to access over 24,800 courses taught by industry experts.
Managing thread execution: Thread pools and executors - Java Tutorial
From the course: Advanced Java: Threads and Concurrency
Managing thread execution: Thread pools and executors
- [Instructor] Creating, managing, and destroying threads is expensive. This statement might not make much sense to you at first. Let's think about it like this. If a company needs subject matter experts for their projects from time to time, hiring them permanently and paying them high salaries and benefits and maintaining them and then firing them would be expensive. Instead, if the company could use the services of a consultancy firm that maintains a pool of expert consultants who can be hired whenever required, it'll be much more cost effective. Similarly, a thread pool is a group of threads that can be used to execute tasks rather than creating, managing, and destroying them every time a task needs to be executed. Threads in a thread pool are reusable. This means that the same thread can be used to execute more than one task. Tasks can be allocated to available threads, and once they are done with the assigned task, they'll be back in the pool available for another task. This is…
Contents
-
-
-
-
-
(Locked)
Managing thread execution: Thread pools and executors4m 3s
-
(Locked)
ExecutorService3m 55s
-
(Locked)
Implementing an executor: ExecutorService in action5m 48s
-
(Locked)
Executing tasks periodically with ScheduledExecutorService6m 22s
-
(Locked)
Challenge: Number magic and voting simulator2m 20s
-
(Locked)
Solution: Number magic and voting simulator5m 41s
-
(Locked)
-
-
-
-
-