43 GUARDED SUSPENSION

This pattern was previously described in Grand98 and is based on the material that appeared in Lea97.

DESCRIPTION

In general, each method in an object is designed to execute a specific task. Sometimes, when a method is invoked on an object, the object may need to be in a certain state, which is logically necessary for the method to carry out the action it is designed for. In such cases, the Guarded Suspension pattern suggests suspending the method execution until such a precondition becomes true. In other words, the requirement for the object to be in a particular state becomes a precondition for the method to execute its implementation of the intended task.

Every class in Java inherits the wait, notify and notifyAll ...

Get Software Architecture Design Patterns in Java 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.