BUG-509: Fix thread safety of listener registration
authorRobert Varga <rovarga@cisco.com>
Tue, 8 Apr 2014 16:07:32 +0000 (18:07 +0200)
committerRobert Varga <rovarga@cisco.com>
Wed, 9 Apr 2014 03:35:49 +0000 (05:35 +0200)
commit48ed21d4e53fee27372f440d8a4ffd603007b991
tree1828f32b1c7d9aec88bcfbc75ff0cc1835d5cfb2
parent0c88a17de4cb8945b99fdec7bc71fde1b97bf5e0
BUG-509: Fix thread safety of listener registration

This commit fixes the race condition where a listener is registered
after preCommit() and before commit(). This is done by moving the
collection into the commit() where it is protected by the
commit/listener synchronized block.

The unregistration safety is handled by wrapping the returned
registration and invoking the equivalent synchronized block.

Change-Id: Ie9abc81b2a773418b34c3051f7665b0dcf047f76
Signed-off-by: Robert Varga <rovarga@cisco.com>
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/DataChangeEventResolver.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/InMemoryDOMDataStore.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/tree/ListenerRegistrationNode.java