Ignore:
Timestamp:
2015-02-03T21:55:54+13:00 (9 years ago)
Author:
ak19
Message:

Removing large chunks of commented out code ahead of changes. The commented out code was specific to Solr 3.3 but do not apply to Solr 4.7.2 that we use now.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gs3-extensions/solr/trunk/src/src/java/org/greenstone/gsdl3/service/GS2SolrSearch.java

    r29542 r29710  
    185185        all_solr_cores.shutdown();
    186186        all_solr_cores = null;
    187        
    188         // For solr 3.3.0's jetty server, but not for solr 4.7.2's jetty server:
    189         /*
    190 
    191         // When cleaning up, not only do we need to empty the solr_core_cache map, but we also need to remove all
    192         // references to this collection's sorlcores in the CoreContainer object, which can be more SolrCores than
    193         // the EmbeddedSolrServers instantiated and added to the solr_core_cache, since the cache does lazy loading
    194         // while the CoreContainer contains all the cores defined in solr.xml, which includes all *possible* cores
    195         // for this collection even if EmbeddedSolrServers for these were not added to the solr_core_cache_map.
    196 
    197         // 1. clear the map keeping track of the solrcores' EmbeddedSolrServers in this collection
    198         solr_core_cache.clear();
    199 
    200         // 2. Remove all SolrCores in the CoreContainer (all_solr_cores) that are specific to this collection
    201         String collection_core_name_prefix = getCollectionCoreNamePrefix();
    202 
    203         if (all_solr_cores!=null) {
    204             Collection<String> coreNames = all_solr_cores.getCoreNames();
    205             if(!coreNames.isEmpty()) {
    206             Iterator<String> coreIterator = coreNames.iterator();
    207             while(coreIterator.hasNext()) {
    208                
    209                 String solrCoreName = coreIterator.next();     
    210                 if(solrCoreName.startsWith(collection_core_name_prefix)) {
    211                
    212                 logger.info("**** Removing collection-specific core: " + solrCoreName + " from CoreContainer");
    213                
    214                 // CoreContainer.remove(String name): removes and returns registered core w/o decrementing it's reference count
    215                 // http://lucene.apache.org/solr/api/index.html?org/apache/solr/core/CoreContainer.html
    216                 SolrCore solr_core = all_solr_cores.remove(solrCoreName);
    217                 while(!solr_core.isClosed()) {
    218                     logger.warn("@@@@@@ " + solrCoreName + " was not closed. Closing....");
    219                     solr_core.close(); // http://lucene.apache.org/solr/api/org/apache/solr/core/SolrCore.html
    220                 }
    221                 if(solr_core.isClosed()) {
    222                     logger.info("@@@@@@ " + solrCoreName + " is closed.");
    223                 }
    224                 solr_core = null;
    225                 }
    226             }
    227             }
    228         }
    229        
    230         // 3. if there are no more solr cores in Greenstone, then all_solr_cores will be empty, null the CoreContainer
    231         // All going well, this will happen when we're ant stopping the Greenstone server and the last Solr collection
    232         // is being deactivated
    233         if (all_solr_cores!=null) {
    234             Collection<String> coreNamesRemaining = all_solr_cores.getCoreNames();
    235             if(coreNamesRemaining.isEmpty()) {
    236             logger.info("**** CoreContainer contains 0 solrCores. Shutting down...");
    237            
    238             all_solr_cores.shutdown(); // wouldn't do anything anyway for 0 cores I think
    239             all_solr_cores = null;
    240             }
    241             else { // else part is just for debugging
    242             Iterator coreIterator = coreNamesRemaining.iterator();
    243             while(coreIterator.hasNext()) {
    244                 logger.error("**** Core: " + coreIterator.next() + " still exists in CoreContainer");
    245             }
    246             }
    247         }
    248         */
    249187    }
    250188
Note: See TracChangeset for help on using the changeset viewer.