Bug 2650: Fix ConcurrentModificationEx in TransactionProxy 91/14591/3
authortpantelis <tpanteli@brocade.com>
Fri, 23 Jan 2015 09:44:07 +0000 (04:44 -0500)
committertpantelis <tpanteli@brocade.com>
Thu, 29 Jan 2015 03:50:42 +0000 (22:50 -0500)
commit166c432bc0611288abf2e13ef8f184cfbb2c101a
tree14f6f93602753cdf39b9470d644a0900c0ec21c3
parent37f0504d391efd8b7d61403759fcc22a6dd3a093
Bug 2650: Fix ConcurrentModificationEx in TransactionProxy

There were a couple patches proposed by other folks. Gary's patch
https://git.opendaylight.org/gerrit/#/c/14577/ to use a BlockingQueue
would work and is slightly simpler code but I prefer to avoid the unneeded synchronization
overhead that BlockingQueue carries as we still need explicit
synchronization for atomic access to txOperationsOnComplete and
transactionContext.

I implemented something similar to Robert's propopsal in
https://git.opendaylight.org/gerrit/#/c/14565/ .

I added a unit test that does a transaction put after an async read but
unfortunately it didn't reproduce the issue due to the behavior of the
akka dispatcher in the unit tests. The read future callback is batched
by the dispatcher even when using the CallingThreadDispatcher so the
synchronous read callback isn't achieved. Somehow the threading behavior
is different in the producton system. Regardless I kept the unit test
anyway - better than not haviing it.

Change-Id: I70f4e2507411c63cff99d03bf046c65e78a8138e
Signed-off-by: tpantelis <tpanteli@brocade.com>
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/TransactionProxy.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/TransactionProxyTest.java

©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.