xxxxxxxxxx
The main differences between a Lock and a synchronized block are:
1) Having a timeout trying to get access to a synchronized block is not possible.
Using Lock.tryLock(long timeout, TimeUnit timeUnit), it is possible.
2) The synchronized block must be fully contained within a single method.
A Lock can have it’s calls to lock() and unlock() in separate methods.