Lucene - Core
  1. Lucene - Core
  2. LUCENE-3637

Make IndexReader.decRef() call refCount.decrementAndGet instead of getAndDecrement

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Trivial Trivial
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.6, 4.0-ALPHA
    • Component/s: core/search
    • Labels:
      None
    • Lucene Fields:
      New, Patch Available

      Description

      IndexReader.decRef() has this code:

          final int rc = refCount.getAndDecrement();
          if (rc == 1) {
      

      I think it will be clearer if it was written like this:

          final int rc = refCount.decrementAndGet();
          if (rc == 0) {
      

      It's a very simple change, which makes reading the code (at least IMO) easier. Will post a patch shortly.

        Activity

        No work has yet been logged on this issue.

          People

          • Assignee:
            Shai Erera
            Reporter:
            Shai Erera
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development