[ 
https://issues.apache.org/jira/browse/SOLR-647?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12622575#action_12622575
 ] 

Noble Paul commented on SOLR-647:
---------------------------------

I fail to see the need for this code in SolrCore#close()
{code:java}
    int count;
    do {
      count = refCount.get();
      if (count <= 0)
        return;
    } while (!refCount.compareAndSet(count, count - 1));
{code}

If you do refCount.decrementAndGet() it should be fine. 

similarly in SolrCore$open() also

you can do a refCount.incrementAndGet() and will be fine. 
What you have written is a duplication of code in AtomicInteger

Even the RefCounted class does increment and decrement in the same way

> Do SolrCore.close() in a refcounted way
> ---------------------------------------
>
>                 Key: SOLR-647
>                 URL: https://issues.apache.org/jira/browse/SOLR-647
>             Project: Solr
>          Issue Type: Bug
>    Affects Versions: 1.3
>            Reporter: Noble Paul
>            Assignee: Grant Ingersoll
>             Fix For: 1.3
>
>         Attachments: refcount_example.patch, solr-647.patch, solr-647.patch, 
> solr-647.patch, solr-647.patch, solr-647.patch, solr-647.patch, 
> SOLR-647.patch, SOLR-647.patch
>
>
> The method _SolrCore.close()_ directly closes the core . It can cause 
> Exceptions for in-flight requests. The _close()_ method should just do a 
> decrement on refcount and the actual close must happen when the last request 
> being processed by that core instance is completed

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to