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 (Updated) (JIRA)" <ji...@apache.org> on 2011/12/11 16:04:39 UTC

[jira] [Updated] (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 updated LUCENE-3637:
-------------------------------

    Attachment: LUCENE-3637.patch

Very trivial patch. If there are no objections, I'd like to commit this.
                
> 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
>            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