Utilizing the mediator pattern for information exchange
A common situation across different types of applications is the requirement to manage communication between clients that require the exchange of information in order to maintain a process. This pattern was identified early and is one of the core patterns of the GoF’s book.
Motivation
The mediator pattern represents an object, a man in the middle, that defines the way that a group of objects interacts within the group. The mediator establishes a free connection for client communication. Clients can refer to each other explicitly through an intermediary. In this way, communication can be moderated.
Finding it in the JDK
Although it may not be obvious at first glance, the mediator pattern can be easily found in the java.base
module and the java.util.concurrent
package. The ExecutorService
class defines a submit
method. Its parent class, Executor
, exposes the execute
method. These methods can be used to pass implementations...