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.
Add a REST method to call the URLProcessor
From the course: Java EE: Concurrency and Multithreading
Add a REST method to call the URLProcessor
- [Instructor] So now let's go ahead and do the last step. You have to add a method to the REST class, get that scheduled executer service object that we've already injected. And submit the task for scheduling of the URL health check. Let's go ahead on the IDE and we've already added that REST class. We just need to go ahead and add a REST method to it. So let's get hold of the resource first. Yes. And here we will just add a @GET API. And what is it going to do? It is going to say public String checkHealthOf the app. Okay, so what is this going to do? Let's have a string message. Okay, and let's go ahead and take the scheduledExecutorService object now, grab that, and go ahead and call the schedule API. Okay, so this will take in three arguments: One is the instance of the URLHealthProcessor. So let's feed the instance to it. The initial delay, let's say is three seconds only. TimeUnit is seconds, of course, and as I said, you may want to actually schedule this health check maybe…
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
-
-
-
-
-
-
Need for Java EE concurrency4m 14s
-
(Locked)
Java EE concurrency APIs3m 52s
-
(Locked)
Set up a Java EE RESTful application8m 4s
-
(Locked)
Running and testing the Java EE RESTful application4m 47s
-
(Locked)
Important Java EE terms4m 4s
-
(Locked)
ManagedExecutorService (MES) overview3m 20s
-
(Locked)
Define the bank account related beans and DAO class3m 28s
-
(Locked)
Add methods in the DAO class10m 30s
-
(Locked)
Define ReportProcessor7m 42s
-
(Locked)
Write REST class for injecting MES objects6m 51s
-
(Locked)
Verify code and add the REST method8m 42s
-
(Locked)
Run and test the ManagedExecutorService application2m 59s
-
(Locked)
ManagedScheduledExecutorService overview2m 22s
-
(Locked)
Defining the URLProcessor for the thread's job6m 47s
-
(Locked)
Add a REST method to call the URLProcessor5m 20s
-
(Locked)
Important pointers and API overview6m 22s
-
(Locked)
ManagedThreadFactory API1m 26s
-
(Locked)
Create a single thread with ManagedThreadFactory6m 7s
-
(Locked)
ManagedThreadFactory with ThreadPoolExecutor7m 2s
-
(Locked)
ContextService API3m 7s
-
(Locked)
Create a contextual proxy9m 15s
-
-
-