BUG-509: Fix thread safety of DOMDataBrokerImpl.ready() 62/5962/1
authorRobert Varga <rovarga@cisco.com>
Thu, 27 Mar 2014 02:51:34 +0000 (03:51 +0100)
committerRobert Varga <rovarga@cisco.com>
Tue, 8 Apr 2014 13:33:36 +0000 (15:33 +0200)
Transition to ready has to occur precisely once, so the process of
taking cohorts has to be synchronized.

Change-Id: I8ba8fe7437dd59547d04fec73f5cd9ed43232161
Signed-off-by: Robert Varga <rovarga@cisco.com>
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/DOMDataBrokerImpl.java

index fc87a91..64a5606 100644 (file)
@@ -190,7 +190,7 @@ public class DOMDataBrokerImpl implements DOMDataBroker, AutoCloseable {
             this.broker = broker;
         }
 
-        public Iterable<DOMStoreThreePhaseCommitCohort> ready() {
+        public synchronized Iterable<DOMStoreThreePhaseCommitCohort> ready() {
             checkState(cohorts == null, "Transaction was already marked as ready.");
             ImmutableList.Builder<DOMStoreThreePhaseCommitCohort> cohortsBuilder = ImmutableList.builder();
             for (DOMStoreWriteTransaction subTx : getSubtransactions()) {

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.