I was just passing through...
Using a guard object helps, but perhaps having a look here may make the code simpler:
https://docs.oracle.com/javase/tutorial/essential/concurrency/locksync.html
I'd go for making methods synchronised, then all that locking stuff goes away and makes the code easier to understand.