-
Task
-
Resolution: Done
-
Critical
-
JBossAS-4.0.3 Final, JBossAS-4.0.3 SP1
-
None
DistributedReplicantManagerImpl maintains a collection of listeners interested in receiving notifications of changes in the replicants registered for a service. The class uses standard callback registration code; ie. synchronizing on the collection before adding/removing listeners, and synchronizing on the collection as part of determining who to call when an event happens (in notifyKeyListeners())..
The problem is the synchronization on the collection is held throughout the process of notifying the listeners. This increases the possibility of deadlock. I'll describe an example of such a deadlock on a forum thread I'll open for this issue.
The synchronization block in notifyKeyListeners() is really serving two purposes – serializing the notifications and coordinating access to the collection of listeners. We should separate these two functions, as well as think through the need for the former.