Changeset 29710 for gs3-extensions

Show
Ignore:
Timestamp:
03.02.2015 21:55:54 (4 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.

Location:
gs3-extensions/solr/trunk/src/src/java/org/greenstone/gsdl3/service
Files:
2 modified

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 
  • gs3-extensions/solr/trunk/src/src/java/org/greenstone/gsdl3/service/SolrSearch.java

    r29355 r29710  
    8383        solr_cores.shutdown(); 
    8484        solr_cores = null; 
    85  
    86         // For solr 3.3.0's jetty server, but not for solr 4.7.2's jetty server 
    87         /* 
    88         // 2. Remove all SolrCores in the CoreContainer (solr_cores) that are specific to this collection 
    89         String collection_core_name_prefix = getCollectionCoreNamePrefix(); 
    90  
    91         Collection<String> coreNames = solr_cores.getCoreNames(); 
    92         if(!coreNames.isEmpty()) { 
    93             Iterator<String> coreIterator = coreNames.iterator(); 
    94             while(coreIterator.hasNext()) { 
    95  
    96             String solrCoreName = coreIterator.next();       
    97             if(solrCoreName.startsWith(collection_core_name_prefix)) { 
    98  
    99                 logger.error("**** Removing collection-specific core: " + solrCoreName + " from CoreContainer"); 
    100  
    101                 // CoreContainer.remove(String name): removes and returns registered core w/o decrementing it's reference count 
    102                 // http://lucene.apache.org/solr/api/index.html?org/apache/solr/core/CoreContainer.html 
    103                 SolrCore solr_core = solr_cores.remove(solrCoreName); 
    104                 while(!solr_core.isClosed()) { 
    105                 logger.error("@@@@@@ " + solrCoreName + " was not closed. Closing...."); 
    106                 solr_core.close(); // http://lucene.apache.org/solr/api/org/apache/solr/core/SolrCore.html 
    107                 }  
    108                 if(solr_core.isClosed()) { 
    109                 logger.error("@@@@@@ " + solrCoreName + " is closed."); 
    110                 } 
    111                 solr_core = null; 
    112             } 
    113             } 
    114         } 
    115  
    116         // 3. if there are no more solr cores in Greenstone, then solr_cores will be empty, null the CoreContainer 
    117         // All going well, this will happen when we're ant stopping the Greenstone server and the last Solr collection 
    118         // is being deactivated 
    119         Collection<String> coreNamesRemaining = solr_cores.getCoreNames(); 
    120         if(coreNamesRemaining.isEmpty()) { 
    121             logger.error("**** CoreContainer contains 0 solrCores. Shutting down..."); 
    122  
    123             solr_cores.shutdown(); // wouldn't do anything anyway for 0 cores I think 
    124             solr_cores = null; 
    125         }  
    126         else { // else part is just for debugging 
    127             Iterator coreIterator = coreNamesRemaining.iterator(); 
    128             while(coreIterator.hasNext()) { 
    129             logger.error("**** Core: " + coreIterator.next() + " still exists in CoreContainer"); 
    130             } 
    131         } 
    132         */ 
    13385    } 
    13486