I think we should clean up the DistributedRegion code associated with
memoryThresholdReachedMembers.
We have made changed to read it while synchronized and make a copy of it to a
new HashSet in getAtomicThresholdInfo. So:
1. We no longer need the method: getMemoryThresholdReachedMembers()
2. this field should no longer be a CopyOnWriteArraySet since we also access it
while synchronized. It should just be a HashSet.
3. change the name of the method "setMemoryThresholdReachedCounterTrue" to
"addCriticalMember" and change the method "removeMemberFromCriticalList" to
"removeCriticalMember".
4. change setMemoryThresholdReachedCounterTrue to only set
memoryThresholdReached if it was empty before our add like so:
synchronized (this.memoryThresholdReachedMembers) {
if (this.memoryThresholdReachedMembers.isEmpty()) {
memoryThresholdReached.set(true);
}
this.memoryThresholdReachedMembers.add(idm);
}
Currently we keep setting it to true when it already is true.
5. change "removeMemberFromCriticalList" to also use isEmpty instead of size:
synchronized (this.memoryThresholdReachedMembers) {
this.memoryThresholdReachedMembers.remove(member);
if (this.memoryThresholdReachedMembers.isEmpty()) {
memoryThresholdReached.set(false);
}
}
[ Full content available at: https://github.com/apache/geode/pull/2320 ]
This message was relayed via gitbox.apache.org for [email protected]