[ https://issues.apache.org/jira/browse/GEODE-5314?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16624265#comment-16624265 ]
ASF subversion and git services commented on GEODE-5314: -------------------------------------------------------- Commit be52507b73e46cf1b8578b23c4ea41ee40afc625 in geode's branch refs/heads/feature/GEODE-5772 from Juan José Ramos [ https://gitbox.apache.org/repos/asf?p=geode.git;h=be52507 ] GEODE-5314: Cleanup and document MBeanStatsMonitor child classes - Fixed minor warnings. - Added JUnit Tests for all modified classes. - There's only one thread updating the mutable values so it's been decided to keep volatiles instead of moving to atomics. - Documentation improved to better explain the thread-safety of the classes. > MBeanStatsMonitor child classes should use atomics instead of volatiles to > avoid data race > ------------------------------------------------------------------------------------------ > > Key: GEODE-5314 > URL: https://issues.apache.org/jira/browse/GEODE-5314 > Project: Geode > Issue Type: Bug > Components: statistics > Reporter: Galen O'Sullivan > Assignee: Juan José Ramos Cassella > Priority: Major > Labels: pull-request-available > Time Spent: 7h > Remaining Estimate: 0h > > {{GcStatsMonitor}} has the following: > {code} > private volatile long collections = 0; > private volatile long collectionTime = 0; > {code} > <snip> > {code} > collections -= > statsMap.getOrDefault(StatsKey.VM_GC_STATS_COLLECTIONS,0).intValue(); > collectionTime -= > statsMap.getOrDefault(StatsKey.VM_GC_STATS_COLLECTION_TIME,0).intValue(); > {code} > Because these are volatile and not atomic fields, there will be a race > condition. Other subclasses of {{MBeanStatsMonitor}} also use volatiles: > AggregateRegionStatsMonitor, GatewaySenderOverflowMonitor, > MemberLevelDiskMonitor, VMStatsMonitor. -- This message was sent by Atlassian JIRA (v7.6.3#76005)