dschneider-pivotal commented on a change in pull request #7145:
URL: https://github.com/apache/geode/pull/7145#discussion_r761565133
##########
File path: geode-core/src/main/java/org/apache/geode/internal/cache/Oplog.java
##########
@@ -191,8 +192,8 @@
*/
private final AtomicLong totalLiveCount = new AtomicLong(0);
- private final ConcurrentMap<Long, DiskRegionInfo> regionMap =
- new ConcurrentHashMap<>();
+ private final AtomicReference<ConcurrentMap<Long, DiskRegionInfo>> regionMap
=
Review comment:
Maybe it would be better to hide this ConcurrentMap and atomic behind a
RegionMap class. It could be a static inner class of Oplog. It looks like we
only use a few methods from ConcurrentMap. Your RegionMap class could use an
atomic but it could also add a "close" method that you could use when you
currently set the atomic to reference an empty map. When you call close you
could just set the atomic to null. In all the methods if they see null then
they can just behave as if the map is empty. Write ops that see a null map
could do nothing or throw an Exception since they really shouldn't happen after
close has been called. Read ops can just return what they would on an empty
ConcurrentMap. This should use even less memory than a default
ConcurrentHashMap and I think it would make the code a bit cleaner.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]