On 6/29/07, Karen Loughran <[EMAIL PROTECTED]> wrote:
Hi all, I have downloaded the latest Solr and have created a solr utility jar based on EmbeddedSolr from the wiki, (http://wiki.apache.org/solr/SolJava). My jar has a search method which basically gets the solr core and calls "searchSolr" (identical to that in EmbeddedSolr) with the passed in string and closes the core before exiting the method. When I make two subsequent calls to my search method from a client program I get the following exception on the 2nd attempt:
Yes, because the SolrCore (currently a static singleton) has been closed. In your search method, don't call close() on the core... it should hang around for the lifetime of your application. -Yonik
29-Jun-2007 13:51:50 org.apache.solr.search.SolrIndexSearcher <init> INFO: Opening [EMAIL PROTECTED] main 29-Jun-2007 13:51:50 org.apache.solr.core.SolrException log SEVERE: java.util.concurrent.RejectedExecutionException at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:1759) at java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:767) at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:658) at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:92) at java.util.concurrent.Executors$DelegatedExecutorService.submit(Executors.java:603) at org.apache.solr.core.SolrCore.getSearcher(SolrCore.java:536) at org.apache.solr.core.SolrCore.getSearcher(SolrCore.java:324) at org.apache.solr.request.SolrQueryRequestBase.getSearcher(SolrQueryRequestBase.java:173) at org.apache.solr.request.StandardRequestHandler.handleRequestBody(StandardRequestHandler.java:114) at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:77) at org.apache.solr.core.SolrCore.execute(SolrCore.java:658) at uk.ac.besc.prism.searcher.impl.SolrSearcher.searchSolr(Unknown Source) at uk.ac.besc.prism.searcher.impl.SolrSearcher.searchSolr(Unknown Source) at uk.ac.besc.prism.searcher.impl.SolrSearcher.searchStarts(Unknown Source) at uk.ac.besc.prism.searcher.client.TestSearchDirect.main(TestSearchDirect.java:47) By the way, EmbeddedSolr as provided works fine, no such exception. I also tried putting a sleep for 5 seconds in case the core had not properly closed before I tried opening it again (through the 2nd call to search). I noticed a discussion in February about the RejectedExecutionException, but its not clear to me whether there was a resolution to it ? http://www.mail-archive.com/[EMAIL PROTECTED]/msg02822.html Can anyone tell me what is causing this and how I can work around it ? Many thanks Karen Loughran