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/06/07 12:28:58 UTC

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

Author: rwesten
Date: Fri Jun  7 10:28:58 2013
New Revision: 1490571

URL: http://svn.apache.org/r1490571
Log:
STANBOL-1081: fixed two other small issues with the unregistration of registered components. ServiceRegistrations where unregistered twice (via the API and the Solr CloseHook#preClose) if the close was originating from an API call the the SolrServerAdapter.

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=1490571&r1=1490570&r2=1490571&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 Jun  7 10:28:58 2013
@@ -164,21 +164,27 @@ public class SolrServerAdapter {
                     for(String name : names){
                         CoreRegistration coreRegistration = registrations.get(name);
                         //we need to check if the core registered for the 
-                        //parsed name is still the same as parsed 
-                        if(coreRegistration.getCore().equals(core)){
-                            log.info("unregister Core with name '{}' based on call to" +
-                                " CloseHook#close()",name);
-                            registrations.remove(name);
-                            coreRegistration.unregister();
-                        } else {
-                            log.info("Core registered for name '{}' is not the same as" +
-                                    " parsed to CloseHook#close()",name);
-                        }
+                        //parsed name is still the same as parsed
+                        if(coreRegistration != null){
+                            if(coreRegistration.getCore().equals(core)){
+                                log.info("unregister Core with name '{}' based on call to" +
+                                    " CloseHook#close()",name);
+                                registrations.remove(name);
+                                coreRegistration.unregister();
+                            } else {
+                                log.info("Core registered for name '{}' is not the same as" +
+                                        " parsed to CloseHook#close()",name);
+                            }
+                        } //else the core was removed by using the API of the SolrServerAdapter
                     }
                 }
             }
             //update the OSGI service for the CoreContainer
-            updateServerRegistration();
+            try {
+                updateServerRegistration();
+            } catch (IllegalStateException e) {
+                log.debug("Server Registration already unregistered ",e);
+            }
         }
 
         @Override