Source EJB 3.1 Specification
4.8.5.1.1 Reentrant Locking Behavior
Special locking semantics apply to loopback calls on Singletons with container-managed concurrency.
If a loopback call occurs on a Singleton that already holds a Write lock on the same thread :
1. If the target of the loopback call is a Read method, the Read lock must always be granted
immediately, without releasing the original Write lock.
2. If the target of the loopback call is a Write method, the call must proceed immediately, with-
out releasing the original Write lock.
Please let me know if my understanding of the below statements is correct or incorrect:
Statement:"
the Read lock must always be granted immediately, without releasing the original Write lock"
Explanation: Loopback call is granted Read Lock and it can perform whatever read operation it wants to perform and this will not effect the Write Lock acquired by the Bean.
Please Let me know the answer for the following questions:
Statement:If the target of the loopback call is a Write method, the call must proceed immediately, with-out releasing the original Write lock.
Question1:
How can container allow the loopback call(target write method) to be process as the Singleton already holds a Write lock on some thread ?
This seems opposite of what has been stated in
Topic 4.8.5.1
If the container invokes a method associated with a Write lock, no other concurrent invocations will be allowed to proceed until the initial Write method’s processing completes.
Question2:What is the difference between "
granting a read or write lock to a loopback call " & "
allowing a lookback call to process immediately" ?