As we saw at the beginning of the chapter, Java EE can silently use threads. Any thread usage is important to identify even if it is good to rely on the Java EE implementation, because it is code that you don't have to maintain. The issue with not identifying the thread is that you can come across cases where your context (ThreadLocal) will not be available or will be available with the wrong values. The other pitfall of not identifying the thread is that you may end up abusing the thread and consuming way more resources on the machine than you need. Let's review a few representative cases of such usages.
Java EE and threads
CDI asynchronous events
CDI 2.0 introduces the notion of asynchronous events. It is a manner...