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.

ScheduledExecutorService overview

ScheduledExecutorService overview

From the course: Java EE: Concurrency and Multithreading

Start my 1-month free trial

ScheduledExecutorService overview

- [Instructor] We have seen the Executor, and we've seen the ExecutorService, now let's take a look at the ScheduledExecutorService interface. It's a sub-interface of the ExecutorService, and as the name suggests, it is used to schedule certain jobs, right? So we just got a special method called a schedule, which will help you run jobs after a given delay. So you can actually start a job after some initial delay and then the job can run for you. Something like that, okay? There are two other flavors of methods: scheduleWithFixedDelay and scheduleAtFixedRate. So those are the methods that you may want to employ if you want to execute your jobs in the application at periodic intervals or with certain definite delay, okay? So let's go to the next slide and see what is the use case that we are going to implement as a part of this API's demo that we are going to do. Now when you talk about schedule jobs in your application, it is generally a very common use case that we have: clean up and…

Contents