jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tomm...@apache.org
Subject svn commit: r1574397 - /jackrabbit/oak/trunk/oak-solr-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/solr/query/SolrQueryIndexProvider.java
Date Wed, 05 Mar 2014 08:51:21 GMT
Author: tommaso
Date: Wed Mar  5 08:51:21 2014
New Revision: 1574397

URL: http://svn.apache.org/r1574397
Log:
OAK-1498 - SolrQueryIndexProvider checks if Solr is reachable before providing QueryIndex

Modified:
    jackrabbit/oak/trunk/oak-solr-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/solr/query/SolrQueryIndexProvider.java

Modified: jackrabbit/oak/trunk/oak-solr-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/solr/query/SolrQueryIndexProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-solr-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/solr/query/SolrQueryIndexProvider.java?rev=1574397&r1=1574396&r2=1574397&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-solr-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/solr/query/SolrQueryIndexProvider.java
(original)
+++ jackrabbit/oak/trunk/oak-solr-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/solr/query/SolrQueryIndexProvider.java
Wed Mar  5 08:51:21 2014
@@ -27,6 +27,7 @@ import org.apache.jackrabbit.oak.spi.que
 import org.apache.jackrabbit.oak.spi.query.QueryIndexProvider;
 import org.apache.jackrabbit.oak.spi.state.ChildNodeEntry;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
+import org.apache.solr.client.solrj.SolrServer;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -66,17 +67,21 @@ public class SolrQueryIndexProvider impl
                 if (log.isDebugEnabled()) {
                     log.debug("found a Solr index definition {}", entry.getName());
                 }
-
                 try {
-                    tempIndexes.add(new SolrQueryIndex(
-                            entry.getName(),
-                            solrServerProvider.getSolrServer(),
-                            oakSolrConfigurationProvider.getConfiguration()));
+                    SolrServer solrServer = solrServerProvider.getSolrServer();
+                    // the query engine should be returned only if the serve is alive, otherwise
other indexes should be used
+                    if (solrServer != null && 0 == solrServer.ping().getStatus())
{
+                        tempIndexes.add(new SolrQueryIndex(
+                                entry.getName(),
+                                solrServer,
+                                oakSolrConfigurationProvider.getConfiguration()));
+                    }
                 } catch (Exception e) {
                     if (log.isErrorEnabled()) {
                         log.error("unable to create Solr query index at " + entry.getName(),
e);
                     }
                 }
+
             }
         }
         return tempIndexes;



Mime
View raw message