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

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

Details

    • Improvement
    • Status: Closed
    • Trivial
    • Resolution: Fixed
    • None
    • 3.6, 4.0-ALPHA
    • core/search
    • None
    • 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

        1. LUCENE-3637.patch
          0.8 kB
          Shai Erera

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: