You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stanbol.apache.org by rw...@apache.org on 2013/07/05 16:32:14 UTC

svn commit: r1500020 - /stanbol/trunk/commons/solr/core/src/main/java/org/apache/stanbol/commons/solr/SolrServerAdapter.java

Author: rwesten
Date: Fri Jul  5 14:32:14 2013
New Revision: 1500020

URL: http://svn.apache.org/r1500020
Log:
fix for STANBOL-1131

Modified:
    stanbol/trunk/commons/solr/core/src/main/java/org/apache/stanbol/commons/solr/SolrServerAdapter.java

Modified: stanbol/trunk/commons/solr/core/src/main/java/org/apache/stanbol/commons/solr/SolrServerAdapter.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/commons/solr/core/src/main/java/org/apache/stanbol/commons/solr/SolrServerAdapter.java?rev=1500020&r1=1500019&r2=1500020&view=diff
==============================================================================
--- stanbol/trunk/commons/solr/core/src/main/java/org/apache/stanbol/commons/solr/SolrServerAdapter.java (original)
+++ stanbol/trunk/commons/solr/core/src/main/java/org/apache/stanbol/commons/solr/SolrServerAdapter.java Fri Jul  5 14:32:14 2013
@@ -427,18 +427,26 @@ public class SolrServerAdapter {
         } finally {
             Thread.currentThread().setContextClassLoader(classLoader);
         }
-        //update the OSGI service for the new Core
-        ServiceReference coreRef = registerCoreService(coreName,core);
-        if(old != null){
-            //cleanup the old core
-            cleanupSolrCore(old);
+        //NOTE: core registration is now done as part of the registration of the
+        //      SolrCore to the CoreContainer
+//        ServiceReference coreRef = registerCoreService(coreName,core);
+//        if(old != null){
+//            //cleanup the old core
+//            cleanupSolrCore(old);
+//        }
+//        // persist the new core to have it available on the next start
+//        //server.persist();
+//        //update the OSGI service is now done by the overridden CoreContainer#create(..)
+//        //method
+//        updateServerRegistration();
+        //so just get the ServiceReference for the ServiceRegistration
+        CoreRegistration reg = registrations.get(coreName);
+        if (reg == null){
+            throw new IllegalStateException("No OSGI ServiceRegistration present after "
+                + "adding SolrCore '"+coreName+"' to SolrCore!");
+        } else {
+            return reg.getServiceReference();
         }
-        // persist the new core to have it available on the next start
-        //server.persist();
-        //update the OSGI service is now done by the overridden CoreContainer#create(..)
-        //method
-        //updateServerRegistration();
-        return coreRef;
     }
     
     /**