From a4ea95b6ef30272a9d625ef9cd9024a381bb1245 Mon Sep 17 00:00:00 2001 From: Robert Muir Date: Sun, 17 Oct 2010 21:13:39 +0000 Subject: [PATCH] clean up searchers git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1023583 13f79535-47bb-0310-9956-ffa450edef68 --- .../test/org/apache/solr/core/TestQuerySenderListener.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/solr/src/test/org/apache/solr/core/TestQuerySenderListener.java b/solr/src/test/org/apache/solr/core/TestQuerySenderListener.java index 8cb657e4dab..8dc426ed4ab 100644 --- a/solr/src/test/org/apache/solr/core/TestQuerySenderListener.java +++ b/solr/src/test/org/apache/solr/core/TestQuerySenderListener.java @@ -19,6 +19,7 @@ package org.apache.solr.core; import org.apache.solr.SolrTestCaseJ4; import org.apache.solr.search.SolrIndexSearcher; +import org.apache.solr.util.RefCounted; import org.apache.solr.common.params.EventParams; import org.apache.lucene.store.Directory; import org.junit.BeforeClass; @@ -48,7 +49,8 @@ public class TestQuerySenderListener extends SolrTestCaseJ4 { assertTrue("Not an instance of QuerySenderListener", newSearcherListener instanceof QuerySenderListener); QuerySenderListener qsl = (QuerySenderListener) newSearcherListener; - SolrIndexSearcher currentSearcher = core.getSearcher().get(); + RefCounted currentSearcherRef = core.getSearcher(); + SolrIndexSearcher currentSearcher = currentSearcherRef.get(); qsl.newSearcher(currentSearcher, null);//test new Searcher MockQuerySenderListenerReqHandler mock = (MockQuerySenderListenerReqHandler) core.getRequestHandler("mock"); assertNotNull("Mock is null", mock); @@ -62,6 +64,8 @@ public class TestQuerySenderListener extends SolrTestCaseJ4 { evt = mock.req.getParams().get(EventParams.EVENT); assertNotNull("Event is null", evt); assertTrue(evt + " is not equal to " + EventParams.NEW_SEARCHER, evt.equals(EventParams.NEW_SEARCHER) == true); + newSearcher.close(); + currentSearcherRef.decref(); } }