maniksurtani/infinispan — comment on commit 682eedd9bb6c69aeacd159899cefb0d617661cdd
File: core/src/main/java/org/infinispan/transaction/AbstractCacheTransaction.java line 126
By maniksurtani:

This is a bit confusing TBH. Let me explain. This can only happen on a remote node, and if the transaction already exists then it must be in its prepare phase. At this point no additional keys can be added to the context. And if the context has a key we are interested in and it is locked, it is best to wait for this transaction to complete before attempting to acquire the same lock in the lock manager. So the notification really comes when the transaction is completed (see notifyOnTransactionFinished()) and not when a specific key is released.

Like I said this is a bit confusing - I wonder why it doesn't just try and acquire the lock on the lock manager and block until the lock is available. I suspect it may have to do with backup locks and lock failover.

Caveat: my explanation above is from reading the code, I haven't yet discussed it further with Mircea. Which is why my optimisations are only simpleones that are "logically equivalent" and not improving the design.