Skip to Content
Software Architecture Design Patterns in Java
book

Software Architecture Design Patterns in Java

by Partha Kuchana
April 2004
Intermediate to advanced
520 pages
10h 10m
English
Auerbach Publications
Content preview from Software Architecture Design Patterns in Java

9 MONITOR

DESCRIPTION

In general, an object may need to access shared resources such as files as part of its implementation to provide the services it is designed for. In a multithreaded environment, when methods of such an object are accessed simultaneously by more than one thread, it could result in unpredictable behavior. Instances of such incorrect and irregular behavior resulting from the concurrent access to an object’s methods by multiple threads are referred to as race conditions.

The monitor is a mechanism to obtain a lock on such an object to ensure that only one thread is allowed to execute any method on that object at any given time. Instead of keeping the responsibility on its client objects, the actual service provider object ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Hands-On Software Architecture with Java

Hands-On Software Architecture with Java

Giuseppe Bonocore

Publisher Resources

ISBN: 9780203496213