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.

Executor and ExecutorService

Executor and ExecutorService

From the course: Java EE: Concurrency and Multithreading

Start my 1-month free trial

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…

Contents