Changeset 29710 for gs3-extensions/solr
- Timestamp:
- 2015-02-03T21:55:54+13:00 (9 years ago)
- Location:
- gs3-extensions/solr/trunk/src/src/java/org/greenstone/gsdl3/service
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
gs3-extensions/solr/trunk/src/src/java/org/greenstone/gsdl3/service/GS2SolrSearch.java
r29542 r29710 185 185 all_solr_cores.shutdown(); 186 186 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 all192 // references to this collection's sorlcores in the CoreContainer object, which can be more SolrCores than193 // the EmbeddedSolrServers instantiated and added to the solr_core_cache, since the cache does lazy loading194 // while the CoreContainer contains all the cores defined in solr.xml, which includes all *possible* cores195 // 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 collection198 solr_core_cache.clear();199 200 // 2. Remove all SolrCores in the CoreContainer (all_solr_cores) that are specific to this collection201 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 count215 // http://lucene.apache.org/solr/api/index.html?org/apache/solr/core/CoreContainer.html216 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.html220 }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 CoreContainer231 // All going well, this will happen when we're ant stopping the Greenstone server and the last Solr collection232 // is being deactivated233 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 think239 all_solr_cores = null;240 }241 else { // else part is just for debugging242 Iterator coreIterator = coreNamesRemaining.iterator();243 while(coreIterator.hasNext()) {244 logger.error("**** Core: " + coreIterator.next() + " still exists in CoreContainer");245 }246 }247 }248 */249 187 } 250 188 -
gs3-extensions/solr/trunk/src/src/java/org/greenstone/gsdl3/service/SolrSearch.java
r29355 r29710 83 83 solr_cores.shutdown(); 84 84 solr_cores = null; 85 86 // For solr 3.3.0's jetty server, but not for solr 4.7.2's jetty server87 /*88 // 2. Remove all SolrCores in the CoreContainer (solr_cores) that are specific to this collection89 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 count102 // http://lucene.apache.org/solr/api/index.html?org/apache/solr/core/CoreContainer.html103 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.html107 }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 CoreContainer117 // All going well, this will happen when we're ant stopping the Greenstone server and the last Solr collection118 // is being deactivated119 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 think124 solr_cores = null;125 }126 else { // else part is just for debugging127 Iterator coreIterator = coreNamesRemaining.iterator();128 while(coreIterator.hasNext()) {129 logger.error("**** Core: " + coreIterator.next() + " still exists in CoreContainer");130 }131 }132 */133 85 } 134 86
Note:
See TracChangeset
for help on using the changeset viewer.