You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@geode.apache.org by "kirklund (GitHub)" <gi...@apache.org> on 2019/03/19 19:13:26 UTC

[GitHub] [geode] kirklund commented on issue #3318: GEODE-6534: Make NonTXEntry entryIsDestroyed volatile

I'm open to other solutions for fixing this. Using AtomicBoolean in the most basic way would end up being more costly:
```
    @Override
    public boolean isDestroyed() {
      entryIsDestroyed.compareAndSet(false,
          isThisRegionBeingClosedOrDestroyed() || LocalRegion.this.basicGetEntry(key) == null);
      return entryIsDestroyed.get();
    }
```
Here's the original code. I made the boolean entryIsDestroyed volatile which isn't perfect but it is better than what's on develop. I could leave it alone but I'm pretty sure it's not really correct:
```
    @Override
    public boolean isDestroyed() {
      if (entryIsDestroyed) {
        return true;
      }
      if (isThisRegionBeingClosedOrDestroyed() || LocalRegion.this.basicGetEntry(key) == null) {
        entryIsDestroyed = true;
      }
      return entryIsDestroyed;
    }
```

[ Full content available at: https://github.com/apache/geode/pull/3318 ]
This message was relayed via gitbox.apache.org for notifications@geode.apache.org