From the course: Java EE: Concurrency and Multithreading
Unlock the full course today
Join today to access over 24,800 courses taught by industry experts.
Executor and ExecutorService
From the course: Java EE: Concurrency and Multithreading
Executor and ExecutorService
- [Narrator] Now let's start taking a look at the Executor Framework Interfaces one by one, and then we'll also do a demo for each one of them. The first among them is the executor interface, so that is the top most interface, and that is going to help you execute a submitted task with the single method execute. It is very simple to actually try to spawn a task with this execute method. We'll see that in a minute. It will help you submit runnable tasks, so whenever you have created a thread in the system you've said new thread, and then you passed in the runnable instance, and then you invoked the start method on it. So instead of that, it is very simple to do this job with the executor interface. You just have to say executor dot execute and parse in your runnable instance. Let's quickly take a look at the demo. Let's come back to the IDE. And that was the test runnable class, right? Where we created an instance of the runnable using the lamda, and then we created an instance of the…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
Features of the Executor framework and thread pools4m 35s
-
(Locked)
Callables and futures2m 16s
-
(Locked)
Executor and ExecutorService3m 58s
-
(Locked)
ExecutorService overview3m 3s
-
(Locked)
Define UserDao and user beans6m 50s
-
(Locked)
Write the UserProcessor callable implementation5m 31s
-
(Locked)
Write a test class and run the application10m 48s
-
(Locked)
Different thread pools5m 20s
-
(Locked)
ExecutorService: invokeAny and invokeAll7m 18s
-
(Locked)
ExecutorService shutdown5m 18s
-
(Locked)
ScheduledExecutorService overview2m 7s
-
(Locked)
The schedule method5m 16s
-
(Locked)
scheduleAtFixedRate and scheduleWithFixedDelay6m 42s
-
(Locked)
ThreadFactory API2m 34s
-
(Locked)
Create a custom thread factory5m 26s
-
-
-
-