Uploaded image for project: 'Lucene - Core'
  1. Lucene - Core
  2. LUCENE-3637

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

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: 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.

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: