You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-dev@lucene.apache.org by Noble Paul നോബിള്‍ नोब्ळ् <no...@gmail.com> on 2009/01/27 12:27:24 UTC

SolrCore refcount == 2. is it a bug?

When I look at the Solr statistics page I see the refcount as 2 .(I'm
not hitting the server)

As aI look at the code I observe these

 private final AtomicInteger refCount = new AtomicInteger(1);

  final void open() {
    refCount.incrementAndGet();
  }

That means for any core that is open the minimum rerfcount  == 2

and the close() is as foloows

 public void close() {
    int count = refCount.decrementAndGet();
    if (count > 0) return; // close is called often, and only actually
closes if nothing is using it.

if i closed the core once I would have the refcount as 1 and it will not close()

Is it true.
I have not yet tested it.





-- 
--Noble Paul

Re: SolrCore refcount == 2. is it a bug?

Posted by Yonik Seeley <ys...@gmail.com>.
Yep, seeing a refcount of 2 is OK.
One of the counts comes from grabbing the core to generate the
statistics... so with no other traffic, the count will be 1 before and
after the statistics request, but 2 during it.

-Yonik

On Tue, Jan 27, 2009 at 6:27 AM, Noble Paul നോബിള്‍  नोब्ळ्
<no...@gmail.com> wrote:
> When I look at the Solr statistics page I see the refcount as 2 .(I'm
> not hitting the server)
>
> As aI look at the code I observe these
>
>  private final AtomicInteger refCount = new AtomicInteger(1);
>
>  final void open() {
>    refCount.incrementAndGet();
>  }
>
> That means for any core that is open the minimum rerfcount  == 2
>
> and the close() is as foloows
>
>  public void close() {
>    int count = refCount.decrementAndGet();
>    if (count > 0) return; // close is called often, and only actually
> closes if nothing is using it.
>
> if i closed the core once I would have the refcount as 1 and it will not close()
>
> Is it true.
> I have not yet tested it.
>
>
>
>
>
> --
> --Noble Paul
>