...
If class Book
changes its synchronization policy in the future, the BookWrapper
class's locking strategy might silently break. For instance, the Bookwrapper
class's locking strategy will definitely break if Book
is modified to use an internal private lock, as recommended by CON04-J. Synchronize using an a private final lock object. This is because threads that call getDueDate()
of class BookWrapper
may perform operations on the thread-safe Book
using its new locking policy, however, threads that call method renew()
will always synchronize on the intrinsic lock of the Book
instance. Consequently, the implementation will use two different locks.
...