Name

Lockable Object Pattern

Goal

Implement simple locking within a single JVM (Figure B-15).

Lockable object
Figure B-15. Lockable object

Participants

Business delegate

Provides access to business logic.

Lockable object

Provides a data object that can be locked for exclusive use by a business delegate.

Interactions

When a business delegate needs to modify an object, it calls the object’s lock( ) method. If a lock can be obtained, the business delegate updates the object and releases the lock.

Get J2EE 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.