9 Asynchronous

WHAT’S IN THIS CHAPTER?            

  • Introduction to asynchronous programming
  • What is asynchronous programming
  • Asynchronous programming using threads
  • Using asynchronous programming in beans
  • Asynchronous programming in servlets
  • When and where to best use asynchronous techniques

WROX.COM CODE DOWNLOADS FOR THIS CHAPTER

The wrox.com code download for this chapter is found at www.wrox.com/go/projavaeedesignpatterns on the Download Code tab. The code is in the Chapter 9 download and individually named according to the names throughout the chapter.

Although asynchronous programming is not always listed as a design pattern, it has been a popular and important programming model for the past decade. The asynchronous programming model relies on multithreading and executing the given functionality in a separate thread. Not only do multithreaded environments and programming languages take advantage of asynchronous programming techniques, but single-threaded platforms, such as the popular server-side JavaScript platform NodeJS, make good use of asynchronous programming principles.

Java was designed to support multiple threads from its start. However, it failed to provide a simple approach to making asynchronous calls. The Future<T> interface, which was introduced in Java 5, was Java’s first attempt at implementing asynchronous ...

Get Professional Java EE Design Patterns now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.