jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tomm...@apache.org
Subject svn commit: r1462190 - /jackrabbit/oak/trunk/oak-solr-embedded/src/main/java/org/apache/jackrabbit/oak/plugins/index/solr/embedded/EmbeddedSolrServerProvider.java
Date Thu, 28 Mar 2013 16:15:00 GMT
Author: tommaso
Date: Thu Mar 28 16:15:00 2013
New Revision: 1462190

URL: http://svn.apache.org/r1462190
Log:
OAK-700 - fixed startup of spawn SolrServer

Modified:
    jackrabbit/oak/trunk/oak-solr-embedded/src/main/java/org/apache/jackrabbit/oak/plugins/index/solr/embedded/EmbeddedSolrServerProvider.java

Modified: jackrabbit/oak/trunk/oak-solr-embedded/src/main/java/org/apache/jackrabbit/oak/plugins/index/solr/embedded/EmbeddedSolrServerProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-solr-embedded/src/main/java/org/apache/jackrabbit/oak/plugins/index/solr/embedded/EmbeddedSolrServerProvider.java?rev=1462190&r1=1462189&r2=1462190&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-solr-embedded/src/main/java/org/apache/jackrabbit/oak/plugins/index/solr/embedded/EmbeddedSolrServerProvider.java
(original)
+++ jackrabbit/oak/trunk/oak-solr-embedded/src/main/java/org/apache/jackrabbit/oak/plugins/index/solr/embedded/EmbeddedSolrServerProvider.java
Thu Mar 28 16:15:00 2013
@@ -100,11 +100,6 @@ public class EmbeddedSolrServerProvider 
     @Override
     public SolrServer getSolrServer() throws Exception {
         // hack needed to let lucene SPIs work in an OSGi deploy
-//        Thread thread = Thread.currentThread();
-//        ClassLoader loader = thread.getContextClassLoader();
-//        thread.setContextClassLoader(Lucene40Codec.class.getClassLoader());
-//        thread.setContextClassLoader(loader);
-
         Codec.reloadCodecs(Thread.currentThread().getContextClassLoader());
 
         if (solrServer == null) {
@@ -130,8 +125,16 @@ public class EmbeddedSolrServerProvider 
         // try spawning a new Solr server using Jetty and connect to it via HTTP
 
         enableSolrCloud(solrHome, DEFAULT_CORE_NAME);
-        JettySolrRunner jettySolrRunner = new JettySolrRunner(solrHome, CONTEXT, solrHttpPort,
"solrconfig.xml", "schema.xml", true);
-        jettySolrRunner.start(true);
+
+        ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
+        Thread.currentThread().setContextClassLoader(JettySolrRunner.class.getClassLoader());
+
+        try {
+            JettySolrRunner jettySolrRunner = new JettySolrRunner(solrHome, CONTEXT, solrHttpPort,
"solrconfig.xml", "schema.xml", true);
+            jettySolrRunner.start(true);
+        } finally {
+            Thread.currentThread().setContextClassLoader(classLoader);
+        }
         HttpSolrServer httpSolrServer = new HttpSolrServer(new StringBuilder(LOCAL_BASE_URL)
                 .append(':').append(solrHttpPort).append(CONTEXT).toString());
         if (OakSolrUtils.checkServerAlive(httpSolrServer)) {
@@ -147,6 +150,7 @@ public class EmbeddedSolrServerProvider 
         System.setProperty(SOLR_HOME_PROPERTY_NAME, solrHome);
         enableSolrCloud(solrHome, DEFAULT_CORE_NAME);
         CoreContainer.Initializer initializer = new CoreContainer.Initializer();
+
         EmbeddedSolrServer embeddedSolrServer = new EmbeddedSolrServer(initializer.initialize(),
DEFAULT_CORE_NAME);
         if (OakSolrUtils.checkServerAlive(embeddedSolrServer)) {
             return embeddedSolrServer;



Mime
View raw message