mirror of https://github.com/apache/lucene.git
add some missing synchronization to CodecProvider
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@980433 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
b0e7f1c661
commit
1a153246d1
|
@ -49,7 +49,7 @@ public abstract class CodecProvider {
|
||||||
|
|
||||||
public final static String[] CORE_CODECS = new String[] {"Standard", "Sep", "Pulsing", "IntBlock", "PreFlex"};
|
public final static String[] CORE_CODECS = new String[] {"Standard", "Sep", "Pulsing", "IntBlock", "PreFlex"};
|
||||||
|
|
||||||
public void register(Codec codec) {
|
public synchronized void register(Codec codec) {
|
||||||
if (codec.name == null) {
|
if (codec.name == null) {
|
||||||
throw new IllegalArgumentException("code.name is null");
|
throw new IllegalArgumentException("code.name is null");
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,7 @@ public abstract class CodecProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @lucene.internal */
|
/** @lucene.internal */
|
||||||
public void unregister(Codec codec) {
|
public synchronized void unregister(Codec codec) {
|
||||||
if (codec.name == null) {
|
if (codec.name == null) {
|
||||||
throw new IllegalArgumentException("code.name is null");
|
throw new IllegalArgumentException("code.name is null");
|
||||||
}
|
}
|
||||||
|
@ -80,7 +80,7 @@ public abstract class CodecProvider {
|
||||||
return knownExtensions;
|
return knownExtensions;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Codec lookup(String name) {
|
public synchronized Codec lookup(String name) {
|
||||||
final Codec codec = (Codec) codecs.get(name);
|
final Codec codec = (Codec) codecs.get(name);
|
||||||
if (codec == null)
|
if (codec == null)
|
||||||
throw new IllegalArgumentException("required codec '" + name + "' not found");
|
throw new IllegalArgumentException("required codec '" + name + "' not found");
|
||||||
|
@ -104,11 +104,11 @@ public abstract class CodecProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Used for testing. @lucene.internal */
|
/** Used for testing. @lucene.internal */
|
||||||
public static void setDefaultCodec(String s) {
|
public synchronized static void setDefaultCodec(String s) {
|
||||||
defaultCodec = s;
|
defaultCodec = s;
|
||||||
}
|
}
|
||||||
/** Used for testing. @lucene.internal */
|
/** Used for testing. @lucene.internal */
|
||||||
public static String getDefaultCodec() {
|
public synchronized static String getDefaultCodec() {
|
||||||
return defaultCodec;
|
return defaultCodec;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue