Change fields in ShardStats to non-volatile 86/16386/3
authorTom Pantelis <tpanteli@brocade.com>
Sun, 8 Mar 2015 12:16:07 +0000 (08:16 -0400)
committerTom Pantelis <tpanteli@brocade.com>
Thu, 12 Mar 2015 02:36:32 +0000 (22:36 -0400)
commite4e87498e57cd4fc6f24cc7aac0412975844e66a
treebdbb5d8b6e619340cdc5b228a4d3f6b584fc0ef8
parent691c47ae72532db04f9b2c33cb8a0cef642e5a17
Change fields in ShardStats to non-volatile

Most if the fields in ShardStats are volatile or AtomicLong counters.
While volatile guarantees immediate thread visibility, we can live with
eventual consistency to avoid the overhead of volatile writes on the
fast path as reads via JMX will be infrequent.

All of the counters except 1 are updated by Shard so concurrent updates
won't occur. failedReadTransactionsCount is updated by ShardTransaction
so we need to keep that as AtomicLong as it will be updated concurrently.
But it's a failure counter so will be updated infrequently.

Change-Id: I6a0f748bd595379243e0ea31d84f6c8d0989003a
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/jmx/mbeans/shard/ShardStats.java