| 2780 | } |
| 2781 | |
| 2782 | public boolean isReloaded() { |
| 2783 | return isReloaded; |
| 2784 | } |
| 2785 | |
| 2786 | // Take control of newSearcherHolder (which should have a reference count of at |
| 2787 | // least 1 already). If the caller wishes to use the newSearcherHolder directly |
| 2788 | // after registering it, then they should increment the reference count *before* |
| 2789 | // calling this method. |
| 2790 | // |
| 2791 | // onDeckSearchers will also be decremented (it should have been incremented |
| 2792 | // as a result of opening a new searcher). |
| 2793 | @SuppressWarnings( |
| 2794 | "ReferenceEquality") // detecting re-registration of the exact same searcher holder |
| 2795 | private void registerSearcher(RefCounted<SolrIndexSearcher> newSearcherHolder) { |
| 2796 | synchronized (searcherLock) { |
| 2797 | try { |
| 2798 | if (_searcher == newSearcherHolder) { |
| 2799 | // trying to re-register the same searcher... this can now happen when a commit has been |
| 2800 | // done but there were no changes to the index. |
| 2801 | |
| 2802 | // decref since the caller should have still incref'd (since they didn't know the searcher |
| 2803 | // was the same) |
| 2804 | newSearcherHolder.decref(); |
| 2805 | return; // still execute the finally block to notify anyone waiting. |
| 2806 | } |
| 2807 | |
| 2808 | if (_searcher != null) { |
| 2809 | _searcher.decref(); // dec refcount for this._searcher |
| 2810 | _searcher = null; |
| 2811 | } |