HI Arturo and Juan Pablo,
I don't disagree with anything either of you have written. I'm all in
favour of the ReentrantLock replacement via a Synchronizer pattern.
I'm only suggesting, as does both Larman/Guthrie and the quoted section
("There is no need to replace synchronized blocks and methods that are
used infrequently (e.g., only performed at startup)..."), that the
double-null-checked synchronized blocks used to protect singletons is
likely still a simpler and better practice, and there'd be little
benefit of a ReentrantLock in those cases. These are only called at
the moment when the singleton is created, i.e., once per session.
Cheers,
Murray
On 13/10/23 06:08, Arturo Bernal wrote:
Hi Murray
I'd like to clarify the main goal of my PR, which is to transition from
traditional synchronized blocks to the more modern ReentrantLocks. The
Synchronizer class is essentially a way to standardize this transition
across the codebase.[...]
...........................................................................
Murray Altheim <murray18 at altheim dot com> = = ===
http://www.altheim.com/murray/ === ===
= = ===
In the evening
The rice leaves in the garden
Rustle in the autumn wind
That blows through my reed hut.
-- Minamoto no Tsunenobu