You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@geode.apache.org by "Anthony Baker (JIRA)" <ji...@apache.org> on 2016/01/08 05:40:46 UTC

[jira] [Updated] (GEODE-488) OffHeapMemoryMonitor deliverNextAbnormalEvent logic needs review

     [ https://issues.apache.org/jira/browse/GEODE-488?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Anthony Baker updated GEODE-488:
--------------------------------
    Fix Version/s: 1.0.0-alpha1

> 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
>            Assignee: Darrel Schneider
>             Fix For: 1.0.0-alpha1
>
>
> 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)