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 2018/11/05 17:48:11 UTC

[GitHub] [geode] kirklund commented on pull request #2776: GEODE-5982: Synchronized access to CacheLoader and CacheWriter

Shouldn't these be private? If they are accessed from another class, then a better approach would be either of these:

1) add getters -- doesn't really improve it a lot but at least we aren't reaching into another class to access and use fat locks.

2) make the uses of these locks completely contained within this class. If you really need to inject code from another class to run within a block holding these locks, then try something like:

```
  public static void execute(final Runnable action) {
    // acquire lock
    try {
      action.run();
    } finally {
      // release lock
    }
  }
```

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