public void reload() throws Exception { container.reload(coreName); }
public void run() { try { solrCore.getCoreDescriptor().getCoreContainer().reload(solrCore.getName()); } catch (Exception e) { LOG.error("Could not restart core ", e); } } }.start();
private EmbeddedSolrServerProvider createEmbeddedSolrServerProvider(boolean http) throws Exception { String tempDirectoryPath = FileUtils.getTempDirectoryPath(); File solrHome = new File(tempDirectoryPath, "solr" + System.nanoTime()); EmbeddedSolrServerConfiguration embeddedSolrServerConfiguration = new EmbeddedSolrServerConfiguration(solrHome.getAbsolutePath(), "oak"); if (http) { embeddedSolrServerConfiguration = embeddedSolrServerConfiguration.withHttpConfiguration("/solr", 8983); } EmbeddedSolrServerProvider embeddedSolrServerProvider = embeddedSolrServerConfiguration.getProvider(); SolrClient solrServer = embeddedSolrServerProvider.getSolrServer(); if (storageEnabled != null && !storageEnabled) { // change schema.xml and reload the core File schemaXML = new File(solrHome.getAbsolutePath() + "/oak/conf", "schema.xml"); InputStream inputStream = getClass().getResourceAsStream("/solr/oak/conf/schema.xml"); String schemaString = IOUtils.toString(inputStream).replace("<dynamicField name=\"*\" type=\"text_general\" indexed=\"true\" stored=\"true\" multiValued=\"true\"/>", "<dynamicField name=\"*\" type=\"text_general\" indexed=\"true\" stored=\"false\" multiValued=\"true\"/>"); FileOutputStream fileOutputStream = new FileOutputStream(schemaXML); IOUtils.copy(new StringReader(schemaString), fileOutputStream); fileOutputStream.flush(); ((EmbeddedSolrServer) solrServer).getCoreContainer().reload("oak"); } return embeddedSolrServerProvider; }
/** * Reloads a SolrCore e.g. to apply a change in its configuration * @param name the name of the Core to reload */ public void reloadCore(String name) { //try to reload log.info("Reload Core {} on CoreContainer {}",name,serverProperties.getServerName()); ClassLoader classLoader = updateContextClassLoader(); try { //TODO: what happens if the core with 'name' is no longer present? server.reload(name); } finally { Thread.currentThread().setContextClassLoader(classLoader); } //if succeeded (re-)register the core registerCoreService(name,null); //update the OSGI service for the CoreContainer updateServerRegistration(); } /**
/** * Reloads a SolrCore e.g. to apply a change in its configuration * @param name the name of the Core to reload * @return The ServiceReference to the SolrCore. * @throws SolrException if the Core could not be reloaded */ public void reloadCore(String name) { //try to reload log.info("Reload Core {} on CoreContainer {}",name,serverProperties.getServerName()); ClassLoader classLoader = updateContextClassLoader(); try { //TODO: what happens if the core with 'name' is no longer present? server.reload(name); } finally { Thread.currentThread().setContextClassLoader(classLoader); } //if succeeded (re-)register the core registerCoreService(name,null); //update the OSGI service for the CoreContainer updateServerRegistration(); } /**
/** * Handler "RELOAD" action * * @param req * @param rsp * * @return true if a modification has resulted that requires persistance * of the CoreContainer configuration. */ protected boolean handleReloadAction(SolrQueryRequest req, SolrQueryResponse rsp) { SolrParams params = req.getParams(); String cname = params.get(CoreAdminParams.CORE); try { coreContainer.reload(cname); return false; // no change on reload } catch (Exception ex) { throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, "Error handling 'reload' action", ex); } }
container.reload(coreIdentifier); } else {