Hazelcast Tip: Use IMap.lock or ILock.lock?

When you call mapLocks.unlock(theKey), your lock is auto-garbage-collected. This is simpler, faster and cleaner.

For ILocks, you have to call destroy as all ILock objects are kept in memory.

If you don’t have lots of locks and you want to follow the j.u.c.Lock interface then you can use ILock otherwise IMap is nicer.