Author: gsingers
Date: Thu Apr 17 03:44:48 2008
New Revision: 649046
URL: http://svn.apache.org/viewvc?rev=649046&view=rev
Log:
SOLR-509: Fix NPE when starting up SolrCore due to FirstSearcher event not
being initialized
Modified:
lucene/solr/trunk/CHANGES.txt
lucene/solr/trunk/src/java/org/apache/solr/core/SolrCore.java
Modified: lucene/solr/trunk/CHANGES.txt
URL:
http://svn.apache.org/viewvc/lucene/solr/trunk/CHANGES.txt?rev=649046&r1=649045&r2=649046&view=diff
==============================================================================
--- lucene/solr/trunk/CHANGES.txt (original)
+++ lucene/solr/trunk/CHANGES.txt Thu Apr 17 03:44:48 2008
@@ -355,7 +355,8 @@
when no RequestHandler is mapped to "/update") now logs error correctly.
(hossman)
-
+26. SOLR-509: Moved firstSearcher event notification to the end of the
SolrCore constructor (Koji Sekiguchi via gsingers)
+
Other Changes
1. SOLR-135: Moved common classes to org.apache.solr.common and altered the
build scripts to make two jars: apache-solr-1.3.jar and
Modified: lucene/solr/trunk/src/java/org/apache/solr/core/SolrCore.java
URL:
http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/core/SolrCore.java?rev=649046&r1=649045&r2=649046&view=diff
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/core/SolrCore.java (original)
+++ lucene/solr/trunk/src/java/org/apache/solr/core/SolrCore.java Thu Apr 17
03:44:48 2008
@@ -396,6 +396,29 @@
// Finally tell anyone who wants to know
loader.inform( loader );
loader.inform( this );
+
+ // execute firstSearcher event
+ //TODO: It may not always be the case that this is the only time the
first searcher event needs to fire.
+ doFirstSearcherEvent(getSearcher().get());
+ }
+ }
+
+ private void doFirstSearcherEvent(final SolrIndexSearcher firstSearcher){
+ if (firstSearcherListeners.size() > 0) {
+ searcherExecutor.submit(
+ new Callable() {
+ public Object call() throws Exception {
+ try {
+ for (SolrEventListener listener : firstSearcherListeners) {
+ listener.newSearcher(firstSearcher,null);
+ }
+ } catch (Throwable e) {
+ SolrException.logOnce(log,null,e);
+ }
+ return null;
+ }
+ }
+ );
}
}
@@ -771,23 +794,6 @@
public Object call() throws Exception {
try {
newSearcher.warm(currSearcher);
- } catch (Throwable e) {
- SolrException.logOnce(log,null,e);
- }
- return null;
- }
- }
- );
- }
-
- if (currSearcher==null && firstSearcherListeners.size() > 0) {
- future = searcherExecutor.submit(
- new Callable() {
- public Object call() throws Exception {
- try {
- for (SolrEventListener listener :
firstSearcherListeners) {
- listener.newSearcher(newSearcher,null);
- }
} catch (Throwable e) {
SolrException.logOnce(log,null,e);
}