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

        Shai Erera created issue -
        Shai Erera made changes -
        Field Original Value New Value
        Attachment LUCENE-3637.patch [ 12506899 ]
        Shai Erera made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Assignee Shai Erera [ shaie ]
        Resolution Fixed [ 1 ]
        Uwe Schindler made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development