Bug 2260: Reduce overhead of unused TransactionProxy instances 59/15859/7
authorTom Pantelis <tpanteli@brocade.com>
Sun, 1 Mar 2015 02:21:10 +0000 (21:21 -0500)
committerMoiz Raja <moraja@cisco.com>
Mon, 9 Mar 2015 18:40:46 +0000 (18:40 +0000)
commit3bd5e35d7d22058d92c1441b6cdca6dd19ea6168
treee580faca79185d1d2f70fceea9aec43c633e7fe7
parent32e32254cf269027359a786735f0b7fb580b39a4
Bug 2260: Reduce overhead of unused TransactionProxy instances

Moved constructon of the operationLimiter and operationCompleter to the
throtteOperation method lazily. Added a volatile initialized boolean for
the lazy check and to "piggy-back" synchronize the updates to
operationLimiter and operationCompleter as well.

In TransactionProxy#ready, if no operations were performed then the
txFutureCallbackMap will be empty so returned a static
NoOpDOMStoreThreePhaseCommitCohort in that case.

The only remaining overhead in the constructor is the
TransactionIdentifier instance. The Builder seemed extraneous here so I
removed it to reduce the overhead from 2 object allocations to 1.

Change-Id: I083d4176c880055938bbf1f21c00da3859d66af6
Signed-off-by: Tom Pantelis <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/main/java/org/opendaylight/controller/cluster/datastore/identifiers/TransactionIdentifier.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.