This chapter finishes up the practical part of the book by talking about two more architectural solutions to threading problems that build on the previous chapter’s notion of asynchronous messaging: A synchronous dispatcher (or “reactor”) and an asynchronous dispatcher (or “Active Object”). These dispatchers can simplify the threading model considerably by letting you minimize—in some cases eliminate—the need for method-level synchronization, thereby making it much easier to write and debug multithreaded applications. Both of these design patterns leverage the object-oriented view of threading discussed in Chapter 8. I’ll demonstrate the Active-Object architecture with an OutputStream derivative that allows two threads to simultaneously write to the console without getting the lines of text mixed together (a problem in UNIX systems).
KeywordsActive Object Multiple Thread Input Queue Personal Purpose Void Close
Unable to display preview. Download preview PDF.