(ConfigSet coreConfig)
| 767 | * inform</code>, this could potentially throw a ConcurrentModificationException |
| 768 | * |
| 769 | * @see SolrCoreAware |
| 770 | */ |
| 771 | public QueryResponseWriter registerResponseWriter( |
| 772 | String name, QueryResponseWriter responseWriter) { |
| 773 | return responseWriters.put(name, responseWriter); |
| 774 | } |
| 775 | |
| 776 | public SolrCore reload(ConfigSet coreConfig) throws IOException { |
| 777 | // only one reload at a time |
| 778 | synchronized (getUpdateHandler().getSolrCoreState().getReloadLock()) { |
| 779 | solrCoreState.increfSolrCoreState(); |
| 780 | |
| 781 | // if directory is changing, then don't pass on state |
| 782 | boolean cloneCoreState = getNewIndexDir().equals(getIndexDir()); |
| 783 | |
| 784 | boolean success = false; |
| 785 | SolrCore core = null; |
| 786 | try { |
| 787 | CoreDescriptor cd = new CoreDescriptor(name, getCoreDescriptor()); |
| 788 | cd.loadExtraProperties(); // Reload the extra properties |
| 789 | core = cloneForReloadCore(cd, coreConfig, cloneCoreState); |
| 790 | |
| 791 | // we open a new IndexWriter to pick up the latest config |
| 792 | core.getUpdateHandler().getSolrCoreState().newIndexWriter(core, false); |
| 793 | |
| 794 | core.getSearcher(true, false, null, true); |
| 795 | success = true; |
| 796 | return core; |
| 797 | } finally { |
| 798 | // close the new core on any errors that have occurred. |
| 799 | if (!success && core != null && core.getOpenCount() > 0) { |
| 800 | IOUtils.closeQuietly(core); |
no test coverage detected