Darrel Schneider created GEODE-488:
--------------------------------------
Summary: OffHeapMemoryMonitor deliverNextAbnormalEvent logic needs
review
Key: GEODE-488
URL: https://issues.apache.org/jira/browse/GEODE-488
Project: Geode
Issue Type: Task
Reporter: Darrel Schneider
OffHeapMemoryMonitor deliverNextAbnormalEvent logic needs review.
It looks like we set it to true but then don't call updateStateAndSendEvent
which is the only code that uses it.
It only uses it if the amount of off-heap memory has changed.
The original intent of it was to deliver an event if the amount of memory has
changed but the non-normal state has not.
This code might be ok; it just needs review.
{code}
while (!this.stopRequested) {
updateStateAndSendEvent(lastOffHeapMemoryUsed);
synchronized (this) {
if (lastOffHeapMemoryUsed == this.offHeapMemoryUsed &&
!this.stopRequested) {
try {
do {
this.wait(1000);
if (this.offHeapMemoryUsed == lastOffHeapMemoryUsed) {
// The wait timed out. So tell the OffHeapMemoryMonitor
// that we need an event if the state is not normal.
deliverNextAbnormalEvent();
// TODO: don't we need a "break" here?
// As it is we set deliverNextAbnormalEvent
// but then go back to sleep in wait.
// We need to call updateStateAndSendEvent
// which tests deliverNextAbnormalEvent.
// But just adding a break is probably not enough.
// We only set deliverNextAbnormalEvent if the wait
// timed out which means that the amount of offHeapMemoryUsed
// did not change.
// But in updateStateAndSendEvent we only deliver an
// abnormal event if the amount of memory changed.
// This code needs to be reviewed with Swapnil but
// it looks to Darrel like deliverNextAbnormalEvent
// can be removed.
} else {
// we have been notified so exit the inner while loop
// and call updateStateAndSendEvent.
lastOffHeapMemoryUsed = this.offHeapMemoryUsed;
break;
}
} while (true);
{code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)