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 fc87a9110576054eb75571167d01f60c1c95c98e..64a5606e3fb613a04a70a76cff65a83759cdd589 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()) {