From the course: Java EE: Concurrency and Multithreading
Unlock the full course today
Join today to access over 24,500 courses taught by industry experts.
Create a contextual proxy
From the course: Java EE: Concurrency and Multithreading
Create a contextual proxy
- [Instructor] Let us take a look at the ContextService API Demo now. We want to make this very simple because ContextService is a very useful advanced scenarios. Let's take a look at what we want to do. The first step is add a REST class in the project, so let's go back to the IDE and add a REST class here, let's say, ContextServiceAPIResource. @Path an addition here. Let's give it a value. Okay, next is inject ContextService object by the resource annotation, so like the way we have injected all the other managed resources, let's inject this one, too. Let's go to the server and let's go to context services and pick up the default context service object available. So, that's the JNDI name. Let's come back to our class, and we'll say @Resource. Let's do a lookup of this object and assign it to a reference or, this is a dependency injection that we're doing, so we're going to say ContextService, take a reference. Okay. Once this is done, we create a simple runnable implementation…
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
-
-
-