From the course: Java EE: Design Patterns and Architecture
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Asynchronous observer
From the course: Java EE: Design Patterns and Architecture
Asynchronous observer
- [Instructor] By default events are synchronous. However, in CDI 2.0 they introduced asynchronous processing of events. There is a new firing method that supports this feature called fireAsync, and a corresponding observer annotation observes async. The events are observed asynchronously and in separate threads so no priority can logically be set. So in the custom endpoint the method becomes fireAsync, and likewise here, and the corresponding observer, so if we go into our CustomerService, becomes like so, but we must remove the priority as this no longer works, and async here as well. Asynchronous and synchronous observers operate independently from each other. So an asynchronous firing of an event cannot be observed by a parameter annotated observers and vice versa. Notification options can be set on the asynchronous firing event. There's allowed a specification of a thread pool for that observer. So I'm going to go down to my asynchronous event here, and I'm going to add some…
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
-
-
-
-
Classic design patterns revisited1m 51s
-
(Locked)
The Singleton design pattern2m 6s
-
(Locked)
Implement a Singleton pool manager5m 58s
-
(Locked)
Advanced Singleton pattern3m 58s
-
(Locked)
Singleton pattern concurrency5m 4s
-
(Locked)
The Facade design pattern2m 10s
-
(Locked)
Implement the Facade pattern4m 54s
-
(Locked)
Advanced Facade services4m 59s
-
(Locked)
The Observer design pattern3m 14s
-
(Locked)
Implement Observer pattern8m 3s
-
(Locked)
Observer priority and qualifiers7m 28s
-
(Locked)
Asynchronous observer3m 54s
-
(Locked)
The Decorator design pattern2m 16s
-
(Locked)
Implement the Decorator pattern8m 39s
-
-
-
-
-
-
-
-
-