You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by us...@apache.org on 2012/08/09 12:35:53 UTC
svn commit: r1371152 - in /lucene/dev/branches/branch_4x: ./ lucene/
lucene/core/
lucene/core/src/java/org/apache/lucene/util/hash/HashFunction.java solr/
solr/core/ solr/core/src/java/org/apache/solr/core/SolrResourceLoader.java
Author: uschindler
Date: Thu Aug 9 10:35:53 2012
New Revision: 1371152
URL: http://svn.apache.org/viewvc?rev=1371152&view=rev
Log:
Merged revision(s) 1371150 from lucene/dev/trunk:
Add support to also reload HashFunctions when Solr boots (otherwise codecs using new hash functions may fail to load).
We may need a better "automatic" reloading with one method call, that reloads all NamedSPILoaders. I will think about it and open issue. Solr could then only call NamedSPILoader.reloadAll(), so all instantiated ones get reloaded automatically. Currently its to risky to add new SPIs without Solr support (because it cannot be tested).
Modified:
lucene/dev/branches/branch_4x/ (props changed)
lucene/dev/branches/branch_4x/lucene/ (props changed)
lucene/dev/branches/branch_4x/lucene/core/ (props changed)
lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/util/hash/HashFunction.java
lucene/dev/branches/branch_4x/solr/ (props changed)
lucene/dev/branches/branch_4x/solr/core/ (props changed)
lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/core/SolrResourceLoader.java
Modified: lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/util/hash/HashFunction.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/util/hash/HashFunction.java?rev=1371152&r1=1371151&r2=1371152&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/util/hash/HashFunction.java (original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/util/hash/HashFunction.java Thu Aug 9 10:35:53 2012
@@ -62,7 +62,21 @@ public abstract class HashFunction imple
return loader.availableServices();
}
-
+ /**
+ * Reloads the hash function list from the given {@link ClassLoader}.
+ * Changes to the function list are visible after the method ends, all
+ * iterators ({@link #availableHashFunctionNames()},...) stay consistent.
+ *
+ * <p><b>NOTE:</b> Only new functions are added, existing ones are
+ * never removed or replaced.
+ *
+ * <p><em>This method is expensive and should only be called for discovery
+ * of new functions on the given classpath/classloader!</em>
+ */
+ public static void reloadHashFunctions(ClassLoader classloader) {
+ loader.reload(classloader);
+ }
+
@Override
public String toString() {
return name;
Modified: lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/core/SolrResourceLoader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/core/SolrResourceLoader.java?rev=1371152&r1=1371151&r2=1371152&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/core/SolrResourceLoader.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/core/SolrResourceLoader.java Thu Aug 9 10:35:53 2012
@@ -36,6 +36,7 @@ import org.apache.lucene.analysis.util.T
import org.apache.lucene.analysis.util.TokenizerFactory;
import org.apache.lucene.codecs.Codec;
import org.apache.lucene.codecs.PostingsFormat;
+import org.apache.lucene.util.hash.HashFunction;
import org.apache.lucene.analysis.util.WordlistLoader;
import org.apache.solr.common.ResourceLoader;
import org.apache.solr.handler.admin.CoreAdminHandler;
@@ -175,6 +176,8 @@ public class SolrResourceLoader implemen
* this ResourceLoader.
*/
void reloadLuceneSPI() {
+ // Hash functions:
+ HashFunction.reloadHashFunctions(this.classLoader);
// Codecs:
PostingsFormat.reloadPostingsFormats(this.classLoader);
Codec.reloadCodecs(this.classLoader);