You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Shai Erera (Resolved) (JIRA)" <ji...@apache.org> on 2011/12/11 19:10:40 UTC

[jira] [Resolved] (LUCENE-3637) Make IndexReader.decRef() call refCount.decrementAndGet instead of getAndDecrement

     [ https://issues.apache.org/jira/browse/LUCENE-3637?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Shai Erera resolved LUCENE-3637.
--------------------------------

    Resolution: Fixed
      Assignee: Shai Erera

Committed rev 1213033 (trunk).
Committed rev 1213036 (3x).
                
> Make IndexReader.decRef() call refCount.decrementAndGet instead of getAndDecrement
> ----------------------------------------------------------------------------------
>
>                 Key: LUCENE-3637
>                 URL: https://issues.apache.org/jira/browse/LUCENE-3637
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: core/search
>            Reporter: Shai Erera
>            Assignee: Shai Erera
>            Priority: Trivial
>             Fix For: 3.6, 4.0
>
>         Attachments: LUCENE-3637.patch
>
>
> IndexReader.decRef() has this code:
> {code}
>     final int rc = refCount.getAndDecrement();
>     if (rc == 1) {
> {code}
> I think it will be clearer if it was written like this:
> {code}
>     final int rc = refCount.decrementAndGet();
>     if (rc == 0) {
> {code}
> It's a very simple change, which makes reading the code (at least IMO) easier. Will post a patch shortly.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org