mirror of https://github.com/apache/lucene.git
SOLR-14526: fix or suppress warnings in apache/solr/core
This commit is contained in:
parent
f59f8fd77b
commit
db9cd0cebb
|
@ -269,6 +269,9 @@ Other Changes
|
|||
* SOLR-14474: Fix remaining auxilliary class warnings in Solr (Erick Erickson)
|
||||
|
||||
* SOLR-14519: Fix or suppress warnings in solr/cloud/autoscaling/ (Erick Erickson)
|
||||
|
||||
* SOLR-14526: fix or suppress warnings in apache/solr/core (Erick Erickson)
|
||||
|
||||
================== 8.5.2 ==================
|
||||
|
||||
Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release.
|
||||
|
|
|
@ -29,11 +29,13 @@ public class AbstractSolrEventListener implements SolrEventListener {
|
|||
public AbstractSolrEventListener(SolrCore core) {
|
||||
this.core = core;
|
||||
}
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
private NamedList args;
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
public NamedList getArgs() { return args; }
|
||||
|
||||
@Override
|
||||
public void init(NamedList args) {
|
||||
public void init(@SuppressWarnings({"rawtypes"})NamedList args) {
|
||||
this.args = args.clone();
|
||||
}
|
||||
|
||||
|
@ -67,6 +69,7 @@ public class AbstractSolrEventListener implements SolrEventListener {
|
|||
* @param currentSearcher If null, add FIRST_SEARCHER, otherwise NEW_SEARCHER
|
||||
* @param nlst The named list to add the EVENT value to
|
||||
*/
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
protected NamedList addEventParms(SolrIndexSearcher currentSearcher, NamedList nlst) {
|
||||
NamedList result = new NamedList();
|
||||
result.addAll(nlst);
|
||||
|
|
|
@ -79,9 +79,11 @@ public class BlobRepository {
|
|||
}
|
||||
|
||||
private final CoreContainer coreContainer;
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
private Map<String, BlobContent> blobs = createMap();
|
||||
|
||||
// for unit tests to override
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
ConcurrentHashMap<String, BlobContent> createMap() {
|
||||
return new ConcurrentHashMap<>();
|
||||
}
|
||||
|
@ -118,8 +120,9 @@ public class BlobRepository {
|
|||
return getBlobIncRef(key.concat(decoder.getName()), () -> addBlob(key, decoder));
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
BlobContentRef getBlobIncRef(String key, Decoder decoder, String url, String sha512) {
|
||||
StringBuffer keyBuilder = new StringBuffer(key);
|
||||
StringBuilder keyBuilder = new StringBuilder(key);
|
||||
if (decoder != null) keyBuilder.append(decoder.getName());
|
||||
keyBuilder.append("/").append(sha512);
|
||||
|
||||
|
@ -127,6 +130,7 @@ public class BlobRepository {
|
|||
}
|
||||
|
||||
// do the actual work returning the appropriate type...
|
||||
@SuppressWarnings({"unchecked"})
|
||||
private <T> BlobContentRef<T> getBlobIncRef(String key, Callable<BlobContent<T>> blobCreator) {
|
||||
BlobContent<T> aBlob;
|
||||
if (this.coreContainer.isZooKeeperAware()) {
|
||||
|
@ -273,7 +277,7 @@ public class BlobRepository {
|
|||
*
|
||||
* @param ref The reference that is already there. Doing multiple calls with same ref will not matter
|
||||
*/
|
||||
public void decrementBlobRefCount(BlobContentRef ref) {
|
||||
public void decrementBlobRefCount(@SuppressWarnings({"rawtypes"})BlobContentRef ref) {
|
||||
if (ref == null) return;
|
||||
synchronized (ref.blob.references) {
|
||||
if (!ref.blob.references.remove(ref)) {
|
||||
|
@ -285,6 +289,7 @@ public class BlobRepository {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
public static class BlobContent<T> {
|
||||
public final String key;
|
||||
private final T content; // holds byte buffer or cached object, holding both is a waste of memory
|
||||
|
|
|
@ -397,7 +397,7 @@ public abstract class CachingDirectoryFactory extends DirectoryFactory {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void init(NamedList args) {
|
||||
public void init(@SuppressWarnings("rawtypes") NamedList args) {
|
||||
maxWriteMBPerSecFlush = (Double) args.get("maxWriteMBPerSecFlush");
|
||||
maxWriteMBPerSecMerge = (Double) args.get("maxWriteMBPerSecMerge");
|
||||
maxWriteMBPerSecRead = (Double) args.get("maxWriteMBPerSecRead");
|
||||
|
|
|
@ -25,7 +25,7 @@ import org.apache.solr.util.plugin.NamedListInitializedPlugin;
|
|||
*/
|
||||
public abstract class CodecFactory implements NamedListInitializedPlugin {
|
||||
@Override
|
||||
public void init(NamedList args) {
|
||||
public void init(@SuppressWarnings({"rawtypes"})NamedList args) {
|
||||
}
|
||||
|
||||
public abstract Codec getCodec();
|
||||
|
|
|
@ -41,6 +41,7 @@ public class ConfigOverlay implements MapSerializable {
|
|||
private Map<String, Object> props;
|
||||
private Map<String, Object> userProps;
|
||||
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public ConfigOverlay(Map<String, Object> jsonObj, int znodeVersion) {
|
||||
if (jsonObj == null) jsonObj = Collections.EMPTY_MAP;
|
||||
this.znodeVersion = znodeVersion;
|
||||
|
@ -61,7 +62,9 @@ public class ConfigOverlay implements MapSerializable {
|
|||
return Utils.getObjectByPath(props, onlyPrimitive, hierarchy);
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public ConfigOverlay setUserProperty(String key, Object val) {
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
Map copy = new LinkedHashMap(userProps);
|
||||
copy.put(key, val);
|
||||
Map<String, Object> jsonObj = new LinkedHashMap<>(this.data);
|
||||
|
@ -71,6 +74,7 @@ public class ConfigOverlay implements MapSerializable {
|
|||
|
||||
public ConfigOverlay unsetUserProperty(String key) {
|
||||
if (!userProps.containsKey(key)) return this;
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
Map copy = new LinkedHashMap(userProps);
|
||||
copy.remove(key);
|
||||
Map<String, Object> jsonObj = new LinkedHashMap<>(this.data);
|
||||
|
@ -78,6 +82,7 @@ public class ConfigOverlay implements MapSerializable {
|
|||
return new ConfigOverlay(jsonObj, znodeVersion);
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
public ConfigOverlay setProperty(String name, Object val) {
|
||||
List<String> hierarchy = checkEditable(name, false, true);
|
||||
Map deepCopy = (Map) Utils.fromJSON(Utils.toJSON(props));
|
||||
|
@ -114,6 +119,7 @@ public class ConfigOverlay implements MapSerializable {
|
|||
|
||||
}
|
||||
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
public ConfigOverlay unsetProperty(String name) {
|
||||
List<String> hierarchy = checkEditable(name, false, true);
|
||||
Map deepCopy = (Map) Utils.fromJSON(Utils.toJSON(props));
|
||||
|
@ -164,6 +170,7 @@ public class ConfigOverlay implements MapSerializable {
|
|||
//The path maps to the xml xpath and value of 1 means it is a tag with a string value and value
|
||||
// of 0 means it is an attribute with string value
|
||||
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
private static Map editable_prop_map = (Map) Utils.fromJSONResource("EditableSolrConfigAttributes.json");
|
||||
|
||||
public static boolean isEditableProp(String path, boolean isXpath, List<String> hierarchy) {
|
||||
|
@ -171,6 +178,7 @@ public class ConfigOverlay implements MapSerializable {
|
|||
}
|
||||
|
||||
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
public static Class checkEditable(String path, boolean isXpath, List<String> hierarchy) {
|
||||
List<String> parts = StrUtils.splitSmart(path, isXpath ? '/' : '.');
|
||||
Object obj = editable_prop_map;
|
||||
|
@ -195,8 +203,10 @@ public class ConfigOverlay implements MapSerializable {
|
|||
return null;
|
||||
}
|
||||
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
static Class[] types = new Class[]{String.class, Boolean.class, Integer.class, Float.class};
|
||||
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
private static Class checkType(Object o, boolean isXpath, boolean isAttr) {
|
||||
if (o instanceof Long) {
|
||||
Long aLong = (Long) o;
|
||||
|
@ -209,6 +219,7 @@ public class ConfigOverlay implements MapSerializable {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public Map<String, String> getEditableSubProperties(String xpath) {
|
||||
Object o = Utils.getObjectByPath(props, false, StrUtils.splitSmart(xpath, '/'));
|
||||
if (o instanceof Map) {
|
||||
|
@ -229,6 +240,7 @@ public class ConfigOverlay implements MapSerializable {
|
|||
return map;
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
public Map<String, Map> getNamedPlugins(String typ) {
|
||||
Map<String, Map> reqHandlers = (Map<String, Map>) data.get(typ);
|
||||
if (reqHandlers == null) return Collections.EMPTY_MAP;
|
||||
|
@ -236,6 +248,7 @@ public class ConfigOverlay implements MapSerializable {
|
|||
}
|
||||
|
||||
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
public ConfigOverlay addNamedPlugin(Map<String, Object> info, String typ) {
|
||||
Map dataCopy = Utils.getDeepCopy(data, 4);
|
||||
Map existing = (Map) dataCopy.get(typ);
|
||||
|
@ -244,6 +257,7 @@ public class ConfigOverlay implements MapSerializable {
|
|||
return new ConfigOverlay(dataCopy, this.znodeVersion);
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
public ConfigOverlay deleteNamedPlugin(String name, String typ) {
|
||||
Map dataCopy = Utils.getDeepCopy(data, 4);
|
||||
Map reqHandler = (Map) dataCopy.get(typ);
|
||||
|
|
|
@ -32,10 +32,12 @@ public class ConfigSet {
|
|||
|
||||
private final IndexSchema indexSchema;
|
||||
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
private final NamedList properties;
|
||||
|
||||
private final boolean trusted;
|
||||
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
public ConfigSet(String name, SolrConfig solrConfig, IndexSchema indexSchema,
|
||||
NamedList properties, boolean trusted) {
|
||||
this.name = name;
|
||||
|
@ -57,6 +59,7 @@ public class ConfigSet {
|
|||
return indexSchema;
|
||||
}
|
||||
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
public NamedList getProperties() {
|
||||
return properties;
|
||||
}
|
||||
|
|
|
@ -52,6 +52,7 @@ public class ConfigSetProperties {
|
|||
* @param name the name of the config set properties file
|
||||
* @return the properties in a NamedList
|
||||
*/
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
public static NamedList readFromResourceLoader(SolrResourceLoader loader, String name) {
|
||||
InputStreamReader reader;
|
||||
try {
|
||||
|
@ -72,6 +73,7 @@ public class ConfigSetProperties {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
public static NamedList readFromInputStream(InputStreamReader reader) {
|
||||
try {
|
||||
Object object = fromJSON(reader);
|
||||
|
|
|
@ -61,6 +61,7 @@ public abstract class ConfigSetService {
|
|||
* @param dcore the core's CoreDescriptor
|
||||
* @return a ConfigSet
|
||||
*/
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
public final ConfigSet loadConfigSet(CoreDescriptor dcore) {
|
||||
|
||||
SolrResourceLoader coreLoader = createCoreResourceLoader(dcore);
|
||||
|
@ -158,6 +159,7 @@ public abstract class ConfigSetService {
|
|||
* @param loader the core's resource loader
|
||||
* @return the ConfigSet properties
|
||||
*/
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
protected NamedList loadConfigSetProperties(CoreDescriptor cd, SolrResourceLoader loader) {
|
||||
return ConfigSetProperties.readFromResourceLoader(loader, cd.getConfigSetPropertiesName());
|
||||
}
|
||||
|
@ -166,6 +168,7 @@ public abstract class ConfigSetService {
|
|||
* Return the ConfigSet flags or null if none.
|
||||
*/
|
||||
// TODO should fold into configSetProps -- SOLR-14059
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
protected NamedList loadConfigSetFlags(CoreDescriptor cd, SolrResourceLoader loader) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -189,6 +189,7 @@ public class CoreContainer {
|
|||
|
||||
private final OrderedExecutor replayUpdatesExecutor;
|
||||
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
protected volatile LogWatcher logging = null;
|
||||
|
||||
private volatile CloserThread backgroundCloser = null;
|
||||
|
@ -340,6 +341,7 @@ public class CoreContainer {
|
|||
new SolrNamedThreadFactory("replayUpdatesExecutor")));
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked"})
|
||||
private synchronized void initializeAuthorizationPlugin(Map<String, Object> authorizationConf) {
|
||||
authorizationConf = Utils.getDeepCopy(authorizationConf, 4);
|
||||
int newVersion = readVersion(authorizationConf);
|
||||
|
@ -374,6 +376,7 @@ public class CoreContainer {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked"})
|
||||
private void initializeAuditloggerPlugin(Map<String, Object> auditConf) {
|
||||
auditConf = Utils.getDeepCopy(auditConf, 4);
|
||||
int newVersion = readVersion(auditConf);
|
||||
|
@ -409,6 +412,7 @@ public class CoreContainer {
|
|||
}
|
||||
|
||||
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
private synchronized void initializeAuthenticationPlugin(Map<String, Object> authenticationConfig) {
|
||||
authenticationConfig = Utils.getDeepCopy(authenticationConfig, 4);
|
||||
int newVersion = readVersion(authenticationConfig);
|
||||
|
@ -506,6 +510,7 @@ public class CoreContainer {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
private static int readVersion(Map<String, Object> conf) {
|
||||
if (conf == null) return -1;
|
||||
Map meta = (Map) conf.get("");
|
||||
|
@ -856,6 +861,7 @@ public class CoreContainer {
|
|||
}
|
||||
|
||||
// MetricsHistoryHandler supports both cloud and standalone configs
|
||||
@SuppressWarnings({"unchecked"})
|
||||
private void createMetricsHistoryHandler() {
|
||||
PluginInfo plugin = cfg.getMetricsConfig().getHistoryHandler();
|
||||
Map<String, Object> initArgs;
|
||||
|
@ -908,6 +914,7 @@ public class CoreContainer {
|
|||
/**
|
||||
* Make sure securityConfHandler is initialized
|
||||
*/
|
||||
@SuppressWarnings({"unchecked"})
|
||||
private void reloadSecurityProperties() {
|
||||
SecurityConfHandler.SecurityConfig securityConfig = securityConfHandler.getSecurityConfig(false);
|
||||
initializeAuthorizationPlugin((Map<String, Object>) securityConfig.getData().get("authorization"));
|
||||
|
@ -1607,7 +1614,7 @@ public class CoreContainer {
|
|||
} catch (SolrCoreState.CoreIsClosedException e) {
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
coreInitFailures.put(cd.getName(), new CoreLoadFailure(cd, (Exception) e));
|
||||
coreInitFailures.put(cd.getName(), new CoreLoadFailure(cd, e));
|
||||
throw new SolrException(ErrorCode.SERVER_ERROR, "Unable to reload core [" + cd.getName() + "]", e);
|
||||
} finally {
|
||||
if (!success && newCore != null && newCore.getOpenCount() > 0) {
|
||||
|
@ -1841,6 +1848,7 @@ public class CoreContainer {
|
|||
|
||||
// ---------------- CoreContainer request handlers --------------
|
||||
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
protected <T> T createHandler(String path, String handlerClass, Class<T> clazz) {
|
||||
T handler = loader.newInstance(handlerClass, clazz, null, new Class[]{CoreContainer.class}, new Object[]{this});
|
||||
if (handler instanceof SolrRequestHandler) {
|
||||
|
@ -1887,6 +1895,7 @@ public class CoreContainer {
|
|||
return cfg.getManagementPath();
|
||||
}
|
||||
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
public LogWatcher getLogging() {
|
||||
return logging;
|
||||
}
|
||||
|
|
|
@ -155,7 +155,7 @@ public class HdfsDirectoryFactory extends CachingDirectoryFactory implements Sol
|
|||
}
|
||||
|
||||
@Override
|
||||
public void init(NamedList args) {
|
||||
public void init(@SuppressWarnings("rawtypes") NamedList args) {
|
||||
super.init(args);
|
||||
params = args.toSolrParams();
|
||||
this.hdfsDataDir = getConfig(HDFS_HOME, null);
|
||||
|
|
|
@ -323,7 +323,7 @@ public final class IndexDeletionPolicyWrapper extends IndexDeletionPolicy {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Collection getFileNames() throws IOException {
|
||||
public Collection<String> getFileNames() throws IOException {
|
||||
return delegate.getFileNames();
|
||||
}
|
||||
|
||||
|
@ -379,7 +379,7 @@ public final class IndexDeletionPolicyWrapper extends IndexDeletionPolicy {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Map getUserData() throws IOException {
|
||||
public Map<String,String> getUserData() throws IOException {
|
||||
return delegate.getUserData();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ public abstract class IndexReaderFactory implements NamedListInitializedPlugin {
|
|||
*
|
||||
*/
|
||||
@Override
|
||||
public void init(NamedList args) {
|
||||
public void init(@SuppressWarnings("rawtypes") NamedList args) {
|
||||
Object v = args.get("setTermIndexDivisor");
|
||||
if (v != null) {
|
||||
throw new IllegalArgumentException("Illegal parameter 'setTermIndexDivisor'");
|
||||
|
|
|
@ -38,8 +38,13 @@ public class InitParams {
|
|||
public static final String TYPE = "initParams";
|
||||
public final String name;
|
||||
public final Set<String> paths;
|
||||
public final NamedList defaults, invariants, appends;
|
||||
private PluginInfo pluginInfo;
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
public final NamedList defaults;
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
public final NamedList invariants;
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
public final NamedList appends;
|
||||
final private PluginInfo pluginInfo;
|
||||
private final Set<String> KNOWN_KEYS = ImmutableSet.of(DEFAULTS, INVARIANTS, APPENDS);
|
||||
|
||||
public InitParams(PluginInfo p) {
|
||||
|
@ -51,6 +56,7 @@ public class InitParams {
|
|||
paths = Set.copyOf(StrUtils.splitSmart(pathStr, ','));
|
||||
}
|
||||
this.paths = paths;
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
NamedList nl = (NamedList) p.initArgs.get(DEFAULTS);
|
||||
defaults = nl == null ? null : nl.getImmutableCopy();
|
||||
nl = (NamedList) p.initArgs.get(INVARIANTS);
|
||||
|
@ -88,6 +94,7 @@ public class InitParams {
|
|||
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
public void apply(PluginInfo info) {
|
||||
if (!info.isFromSolrConfig()) {
|
||||
//if this is a component implicitly defined in code it should be overridden by initPrams
|
||||
|
@ -110,6 +117,7 @@ public class InitParams {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
private static void merge(NamedList first, NamedList second, NamedList sink, String name, boolean appends) {
|
||||
if (first == null && second == null) return;
|
||||
if (first == null) first = new NamedList();
|
||||
|
|
|
@ -47,6 +47,7 @@ public class MMapDirectoryFactory extends StandardDirectoryFactory {
|
|||
private int maxChunk;
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
public void init(NamedList args) {
|
||||
super.init(args);
|
||||
SolrParams params = args.toSolrParams();
|
||||
|
|
|
@ -44,6 +44,7 @@ public class MemClassLoader extends ClassLoader implements AutoCloseable, Resour
|
|||
private boolean allJarsLoaded = false;
|
||||
private final SolrResourceLoader parentLoader;
|
||||
private List<PluginBag.RuntimeLib> libs = new ArrayList<>();
|
||||
@SuppressWarnings("rawtypes")
|
||||
private Map<String, Class> classCache = new HashMap<>();
|
||||
private List<String> errors = new ArrayList<>();
|
||||
|
||||
|
@ -97,6 +98,7 @@ public class MemClassLoader extends ClassLoader implements AutoCloseable, Resour
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
private synchronized Class<?> loadFromRuntimeLibs(String name) throws ClassNotFoundException {
|
||||
Class result = classCache.get(name);
|
||||
if(result != null)
|
||||
|
@ -149,11 +151,12 @@ public class MemClassLoader extends ClassLoader implements AutoCloseable, Resour
|
|||
}
|
||||
|
||||
@Override
|
||||
public void close() throws Exception {
|
||||
public void close() {
|
||||
for (PluginBag.RuntimeLib lib : libs) {
|
||||
try {
|
||||
lib.close();
|
||||
} catch (Exception e) {
|
||||
log.error("Error closing lib {}", lib.getName(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,6 +36,7 @@ public class NRTCachingDirectoryFactory extends StandardDirectoryFactory {
|
|||
private double maxCachedMB = DEFAULT_MAX_CACHED_MB;
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
public void init(NamedList args) {
|
||||
super.init(args);
|
||||
SolrParams params = args.toSolrParams();
|
||||
|
|
|
@ -69,6 +69,7 @@ public class PluginBag<T> implements AutoCloseable {
|
|||
private final Map<String, PluginHolder<T>> registry;
|
||||
private final Map<String, PluginHolder<T>> immutableRegistry;
|
||||
private String def;
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
private final Class klass;
|
||||
private SolrCore core;
|
||||
private final SolrConfig.SolrPluginInfo meta;
|
||||
|
@ -119,6 +120,7 @@ public class PluginBag<T> implements AutoCloseable {
|
|||
/**
|
||||
* Check if any of the mentioned names are missing. If yes, return the Set of missing names
|
||||
*/
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public Set<String> checkContains(Collection<String> names) {
|
||||
if (names == null || names.isEmpty()) return Collections.EMPTY_SET;
|
||||
HashSet<String> result = new HashSet<>();
|
||||
|
@ -126,6 +128,7 @@ public class PluginBag<T> implements AutoCloseable {
|
|||
return result;
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public PluginHolder<T> createPlugin(PluginInfo info) {
|
||||
if ("true".equals(String.valueOf(info.attributes.get("runtimeLib")))) {
|
||||
if (log.isDebugEnabled()) {
|
||||
|
@ -148,7 +151,7 @@ public class PluginBag<T> implements AutoCloseable {
|
|||
PackagePluginHolder<T> holder = new PackagePluginHolder<>(info, core, meta);
|
||||
return holder;
|
||||
} else {
|
||||
T inst = core.createInstance(info.className, (Class<T>) meta.clazz, meta.getCleanTag(), null, core.getResourceLoader(info.pkgName));
|
||||
T inst = SolrCore.createInstance(info.className, (Class<T>) meta.clazz, meta.getCleanTag(), null, core.getResourceLoader(info.pkgName));
|
||||
initInstance(inst, info);
|
||||
return new PluginHolder<>(info, inst);
|
||||
}
|
||||
|
@ -208,6 +211,7 @@ public class PluginBag<T> implements AutoCloseable {
|
|||
return old == null ? null : old.get();
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public PluginHolder<T> put(String name, PluginHolder<T> plugin) {
|
||||
Boolean registerApi = null;
|
||||
Boolean disableHandler = null;
|
||||
|
@ -382,14 +386,21 @@ public class PluginBag<T> implements AutoCloseable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void close() throws Exception {
|
||||
public void close() {
|
||||
// TODO: there may be a race here. One thread can be creating a plugin
|
||||
// and another thread can come along and close everything (missing the plugin
|
||||
// that is in the state of being created and will probably never have close() called on it).
|
||||
// can close() be called concurrently with other methods?
|
||||
if (isLoaded()) {
|
||||
T myInst = get();
|
||||
if (myInst != null && myInst instanceof AutoCloseable) ((AutoCloseable) myInst).close();
|
||||
// N.B. instanceof returns false if myInst is null
|
||||
if (myInst instanceof AutoCloseable) {
|
||||
try {
|
||||
((AutoCloseable) myInst).close();
|
||||
} catch (Exception e) {
|
||||
log.error("Error closing {}", inst , e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -459,10 +470,11 @@ public class PluginBag<T> implements AutoCloseable {
|
|||
MemClassLoader loader = (MemClassLoader) resourceLoader;
|
||||
loader.loadJars();
|
||||
}
|
||||
@SuppressWarnings({"unchecked"})
|
||||
Class<T> clazz = (Class<T>) pluginMeta.clazz;
|
||||
T localInst = null;
|
||||
try {
|
||||
localInst = core.createInstance(pluginInfo.className, clazz, pluginMeta.getCleanTag(), null, resourceLoader);
|
||||
localInst = SolrCore.createInstance(pluginInfo.className, clazz, pluginMeta.getCleanTag(), null, resourceLoader);
|
||||
} catch (SolrException e) {
|
||||
if (isRuntimeLib && !(resourceLoader instanceof MemClassLoader)) {
|
||||
throw new SolrException(SolrException.ErrorCode.getErrorCode(e.code()),
|
||||
|
@ -489,8 +501,6 @@ public class PluginBag<T> implements AutoCloseable {
|
|||
lazyInst = localInst; // only assign the volatile until after the plugin is completely ready to use
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -526,9 +536,7 @@ public class PluginBag<T> implements AutoCloseable {
|
|||
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, StrUtils.formatString(BlobRepository.INVALID_JAR_MSG, url, sha512, digest) );
|
||||
}
|
||||
log.info("dynamic library verified {}, sha512: {}", url, sha512);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public RuntimeLib(SolrCore core) {
|
||||
|
@ -539,6 +547,7 @@ public class PluginBag<T> implements AutoCloseable {
|
|||
return url;
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked"})
|
||||
void loadJar() {
|
||||
if (jarContent != null) return;
|
||||
synchronized (this) {
|
||||
|
@ -601,7 +610,7 @@ public class PluginBag<T> implements AutoCloseable {
|
|||
|
||||
|
||||
@Override
|
||||
public void close() throws Exception {
|
||||
public void close() {
|
||||
if (jarContent != null) coreContainer.getBlobRepository().decrementBlobRefCount(jarContent);
|
||||
}
|
||||
|
||||
|
|
|
@ -42,6 +42,7 @@ import static org.apache.solr.schema.FieldType.CLASS_NAME;
|
|||
*/
|
||||
public class PluginInfo implements MapSerializable {
|
||||
public final String name, className, type, pkgName;
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
public final NamedList initArgs;
|
||||
public final Map<String, String> attributes;
|
||||
public final List<PluginInfo> children;
|
||||
|
@ -49,7 +50,7 @@ public class PluginInfo implements MapSerializable {
|
|||
|
||||
|
||||
|
||||
public PluginInfo(String type, Map<String, String> attrs, NamedList initArgs, List<PluginInfo> children) {
|
||||
public PluginInfo(String type, Map<String, String> attrs, @SuppressWarnings({"rawtypes"})NamedList initArgs, List<PluginInfo> children) {
|
||||
this.type = type;
|
||||
this.name = attrs.get(NAME);
|
||||
Pair<String, String> parsed = parseClassName(attrs.get(CLASS_NAME));
|
||||
|
@ -92,6 +93,7 @@ public class PluginInfo implements MapSerializable {
|
|||
isFromSolrConfig = true;
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
public PluginInfo(String type, Map<String,Object> map) {
|
||||
LinkedHashMap m = new LinkedHashMap<>(map);
|
||||
initArgs = new NamedList();
|
||||
|
@ -163,6 +165,7 @@ public class PluginInfo implements MapSerializable {
|
|||
return l.isEmpty() ? null:l.get(0);
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
public Map<String, Object> toMap(Map<String, Object> map) {
|
||||
map.putAll(attributes);
|
||||
Map m = map;
|
||||
|
@ -197,6 +200,7 @@ public class PluginInfo implements MapSerializable {
|
|||
for (PluginInfo child : children) if(type.equals(child.type)) result.add(child);
|
||||
return result;
|
||||
}
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
public static final PluginInfo EMPTY_INFO = new PluginInfo("",Collections.<String,String>emptyMap(), new NamedList(),Collections.<PluginInfo>emptyList());
|
||||
|
||||
private static final HashSet<String> NL_TAGS = new HashSet<>
|
||||
|
|
|
@ -45,6 +45,7 @@ public class QuerySenderListener extends AbstractSolrEventListener {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
public void newSearcher(SolrIndexSearcher newSearcher, SolrIndexSearcher currentSearcher) {
|
||||
final SolrIndexSearcher searcher = newSearcher;
|
||||
log.debug("QuerySenderListener sending requests to {}", newSearcher);
|
||||
|
|
|
@ -47,10 +47,12 @@ import static org.apache.solr.common.util.Utils.getDeepCopy;
|
|||
public class RequestParams implements MapSerializable {
|
||||
private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
|
||||
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
private final Map data;
|
||||
private final Map<String, ParamSet> paramsets = new LinkedHashMap<>();
|
||||
private final int znodeVersion;
|
||||
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
public RequestParams(Map data, int znodeVersion) {
|
||||
if (data == null) data = Collections.EMPTY_MAP;
|
||||
this.data = data;
|
||||
|
@ -67,6 +69,7 @@ public class RequestParams implements MapSerializable {
|
|||
this.znodeVersion = znodeVersion;
|
||||
}
|
||||
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
public static ParamSet createParamSet(Map map, Long version) {
|
||||
Map copy = getDeepCopy(map, 3);
|
||||
Map meta = (Map) copy.remove("");
|
||||
|
@ -82,9 +85,13 @@ public class RequestParams implements MapSerializable {
|
|||
* This converts Lists to arrays of strings. Because Solr expects
|
||||
* params to be String[]
|
||||
*/
|
||||
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
private static Map getMapCopy(Map value) {
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
Map copy = new LinkedHashMap<>();
|
||||
for (Object o1 : value.entrySet()) {
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
Map.Entry entry = (Map.Entry) o1;
|
||||
if ("".equals(entry.getKey())) {
|
||||
copy.put(entry.getKey(), entry.getValue());
|
||||
|
@ -92,6 +99,7 @@ public class RequestParams implements MapSerializable {
|
|||
}
|
||||
if (entry.getValue() != null) {
|
||||
if (entry.getValue() instanceof List) {
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
List l = (List) entry.getValue();
|
||||
String[] sarr = new String[l.size()];
|
||||
for (int i = 0; i < l.size(); i++) {
|
||||
|
@ -122,10 +130,12 @@ public class RequestParams implements MapSerializable {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public Map<String, Object> toMap(Map<String, Object> map) {
|
||||
return getMapWithVersion(data, znodeVersion);
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
public static Map<String, Object> getMapWithVersion(Map<String, Object> data, int znodeVersion) {
|
||||
Map result = new LinkedHashMap();
|
||||
result.put(ConfigOverlay.ZNODEVER, znodeVersion);
|
||||
|
@ -133,6 +143,7 @@ public class RequestParams implements MapSerializable {
|
|||
return result;
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
public RequestParams setParams(String name, ParamSet paramSet) {
|
||||
Map deepCopy = getDeepCopy(data, 3);
|
||||
Map p = (Map) deepCopy.get(NAME);
|
||||
|
@ -182,6 +193,7 @@ public class RequestParams implements MapSerializable {
|
|||
log.info("conf resource {} loaded . version : {} ", name, version);
|
||||
}
|
||||
try {
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
Map m = (Map) fromJSON (in);
|
||||
return new Object[]{m, version};
|
||||
} catch (Exception e) {
|
||||
|
@ -206,10 +218,13 @@ public class RequestParams implements MapSerializable {
|
|||
public static final String INVARIANTS = "_invariants_";
|
||||
|
||||
public static class ParamSet implements MapSerializable {
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
private final Map defaults, appends, invariants;
|
||||
Map<String, VersionedParams> paramsMap;
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
public final Map meta;
|
||||
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
ParamSet(Map defaults, Map invariants, Map appends, Map meta) {
|
||||
this.defaults = defaults;
|
||||
this.invariants = invariants;
|
||||
|
@ -227,6 +242,7 @@ public class RequestParams implements MapSerializable {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public Map<String, Object> toMap(Map<String, Object> result) {
|
||||
result.putAll(defaults);
|
||||
if (appends != null) result.put(APPENDS, appends);
|
||||
|
@ -236,7 +252,8 @@ public class RequestParams implements MapSerializable {
|
|||
}
|
||||
|
||||
|
||||
public ParamSet update(Map map) {
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
public ParamSet update(@SuppressWarnings({"rawtypes"})Map map) {
|
||||
ParamSet p = createParamSet(map, null);
|
||||
return new ParamSet(
|
||||
mergeMaps(getDeepCopy(defaults, 2), p.defaults),
|
||||
|
@ -246,6 +263,7 @@ public class RequestParams implements MapSerializable {
|
|||
);
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
private static Map mergeMaps(Map m1, Map m2) {
|
||||
if (m1 == null && m2 == null) return null;
|
||||
if (m1 == null) return m2;
|
||||
|
@ -263,6 +281,7 @@ public class RequestParams implements MapSerializable {
|
|||
|
||||
/**get the raw map
|
||||
*/
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public Map<String, Object> get() {
|
||||
return defaults;
|
||||
}
|
||||
|
@ -271,6 +290,7 @@ public class RequestParams implements MapSerializable {
|
|||
public static class VersionedParams extends MapSolrParams {
|
||||
final ParamSet paramSet;
|
||||
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
public VersionedParams(Map map, ParamSet paramSet) {
|
||||
super(getMapCopy(map));
|
||||
this.paramSet = paramSet;
|
||||
|
|
|
@ -73,6 +73,7 @@ public class SchemaCodecFactory extends CodecFactory implements SolrCoreAware {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
public void init(NamedList args) {
|
||||
super.init(args);
|
||||
assert codec == null;
|
||||
|
|
|
@ -25,6 +25,7 @@ public class SimpleTextCodecFactory extends CodecFactory {
|
|||
private Codec codec;
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
public void init(NamedList args) {
|
||||
super.init(args);
|
||||
assert codec == null;
|
||||
|
|
|
@ -368,11 +368,13 @@ public class SolrConfig extends XmlConfigFile implements MapSerializable {
|
|||
|
||||
public static class SolrPluginInfo {
|
||||
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
public final Class clazz;
|
||||
public final String tag;
|
||||
public final Set<PluginOpts> options;
|
||||
|
||||
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
private SolrPluginInfo(Class clz, String tag, PluginOpts... opts) {
|
||||
this.clazz = clz;
|
||||
this.tag = tag;
|
||||
|
@ -389,6 +391,7 @@ public class SolrConfig extends XmlConfigFile implements MapSerializable {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
public static ConfigOverlay getConfigOverlay(SolrResourceLoader loader) {
|
||||
InputStream in = null;
|
||||
InputStreamReader isr = null;
|
||||
|
@ -672,6 +675,7 @@ public class SolrConfig extends XmlConfigFile implements MapSerializable {
|
|||
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
public Map<String, Object> toMap(Map<String, Object> map) {
|
||||
LinkedHashMap result = new LinkedHashMap();
|
||||
result.put("indexWriter", makeMap("closeWaitsForMerges", indexWriterCloseWaitsForMerges));
|
||||
|
@ -706,6 +710,7 @@ public class SolrConfig extends XmlConfigFile implements MapSerializable {
|
|||
* SearchComponent, QueryConverter, SolrEventListener, DirectoryFactory,
|
||||
* IndexDeletionPolicy, IndexReaderFactory, {@link TransformerFactory}
|
||||
*/
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
public List<PluginInfo> getPluginInfos(String type) {
|
||||
List<PluginInfo> result = pluginStore.get(type);
|
||||
SolrPluginInfo info = classVsSolrPluginInfo.get(type);
|
||||
|
@ -856,6 +861,7 @@ public class SolrConfig extends XmlConfigFile implements MapSerializable {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
public Map<String, Object> toMap(Map<String, Object> result) {
|
||||
if (getZnodeVersion() > -1) result.put(ZNODEVER, getZnodeVersion());
|
||||
result.put(IndexSchema.LUCENE_MATCH_VERSION_PARAM, luceneMatchVersion);
|
||||
|
@ -914,6 +920,7 @@ public class SolrConfig extends XmlConfigFile implements MapSerializable {
|
|||
return result;
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
private void addCacheConfig(Map queryMap, CacheConfig... cache) {
|
||||
if (cache == null) return;
|
||||
for (CacheConfig config : cache) if (config != null) queryMap.put(config.getNodeName(), config);
|
||||
|
|
|
@ -196,6 +196,7 @@ public final class SolrCore implements SolrInfoBean, Closeable {
|
|||
private final SolrConfig solrConfig;
|
||||
private final SolrResourceLoader resourceLoader;
|
||||
private volatile IndexSchema schema;
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
private final NamedList configSetProperties;
|
||||
private final String dataDir;
|
||||
private final String ulogDir;
|
||||
|
@ -354,6 +355,7 @@ public final class SolrCore implements SolrInfoBean, Closeable {
|
|||
this.schema = replacementSchema;
|
||||
}
|
||||
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
public NamedList getConfigSetProperties() {
|
||||
return configSetProperties;
|
||||
}
|
||||
|
@ -2018,7 +2020,7 @@ public final class SolrCore implements SolrInfoBean, Closeable {
|
|||
}
|
||||
|
||||
|
||||
public RefCounted<SolrIndexSearcher> getSearcher(boolean forceNew, boolean returnSearcher, final Future[] waitSearcher) {
|
||||
public RefCounted<SolrIndexSearcher> getSearcher(boolean forceNew, boolean returnSearcher, @SuppressWarnings({"rawtypes"})final Future[] waitSearcher) {
|
||||
return getSearcher(forceNew, returnSearcher, waitSearcher, false);
|
||||
}
|
||||
|
||||
|
@ -2214,7 +2216,7 @@ public final class SolrCore implements SolrInfoBean, Closeable {
|
|||
* @param waitSearcher if non-null, will be filled in with a {@link Future} that will return after the new searcher is registered.
|
||||
* @param updateHandlerReopens if true, the UpdateHandler will be used when reopening a {@link SolrIndexSearcher}.
|
||||
*/
|
||||
public RefCounted<SolrIndexSearcher> getSearcher(boolean forceNew, boolean returnSearcher, final Future[] waitSearcher, boolean updateHandlerReopens) {
|
||||
public RefCounted<SolrIndexSearcher> getSearcher(boolean forceNew, boolean returnSearcher, @SuppressWarnings({"rawtypes"})final Future[] waitSearcher, boolean updateHandlerReopens) {
|
||||
// it may take some time to open an index.... we may need to make
|
||||
// sure that two threads aren't trying to open one at the same time
|
||||
// if it isn't necessary.
|
||||
|
@ -2321,6 +2323,7 @@ public final class SolrCore implements SolrInfoBean, Closeable {
|
|||
|
||||
final SolrIndexSearcher currSearcher = currSearcherHolder == null ? null : currSearcherHolder.get();
|
||||
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
Future future = null;
|
||||
|
||||
// if the underlying searcher has not changed, no warming is needed
|
||||
|
@ -2803,6 +2806,7 @@ public final class SolrCore implements SolrInfoBean, Closeable {
|
|||
|
||||
private final PluginBag<TransformerFactory> transformerFactories = new PluginBag<>(TransformerFactory.class, this);
|
||||
|
||||
@SuppressWarnings({"unchecked"})
|
||||
<T> Map<String, T> createInstances(Map<String, Class<? extends T>> map) {
|
||||
Map<String, T> result = new LinkedHashMap<>(map.size(), 1);
|
||||
for (Map.Entry<String, Class<? extends T>> e : map.entrySet()) {
|
||||
|
@ -2851,7 +2855,7 @@ public final class SolrCore implements SolrInfoBean, Closeable {
|
|||
return def;
|
||||
}
|
||||
|
||||
public void initDefaultPlugin(Object plugin, Class type) {
|
||||
public void initDefaultPlugin(Object plugin, @SuppressWarnings({"rawtypes"})Class type) {
|
||||
if (plugin instanceof SolrMetricProducer) {
|
||||
coreMetricManager.registerMetricProducer(type.getSimpleName() + ".default", (SolrMetricProducer) plugin);
|
||||
}
|
||||
|
@ -3164,8 +3168,10 @@ public final class SolrCore implements SolrInfoBean, Closeable {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
private static final Map implicitPluginsInfo = (Map) Utils.fromJSONResource("ImplicitPlugins.json");
|
||||
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
public List<PluginInfo> getImplicitHandlers() {
|
||||
List<PluginInfo> implicits = new ArrayList<>();
|
||||
Map requestHandlers = (Map) implicitPluginsInfo.get(SolrRequestHandler.TYPE);
|
||||
|
@ -3190,12 +3196,14 @@ public final class SolrCore implements SolrInfoBean, Closeable {
|
|||
* @param decoder a decoder with which to convert the blob into a Java Object representation (first time only)
|
||||
* @return a reference to the blob that has already cached the decoded version.
|
||||
*/
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
public BlobRepository.BlobContentRef loadDecodeAndCacheBlob(String key, BlobRepository.Decoder<Object> decoder) {
|
||||
// make sure component authors don't give us oddball keys with no version...
|
||||
if (!BlobRepository.BLOB_KEY_PATTERN_CHECKER.matcher(key).matches()) {
|
||||
throw new IllegalArgumentException("invalid key format, must end in /N where N is the version number");
|
||||
}
|
||||
// define the blob
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
BlobRepository.BlobContentRef blobRef = coreContainer.getBlobRepository().getBlobIncRef(key, decoder);
|
||||
addCloseHook(new CloseHook() {
|
||||
@Override
|
||||
|
|
|
@ -48,7 +48,7 @@ public class SolrDeletionPolicy extends IndexDeletionPolicy implements NamedList
|
|||
private int maxOptimizedCommitsToKeep = 0;
|
||||
|
||||
@Override
|
||||
public void init(NamedList args) {
|
||||
public void init(@SuppressWarnings("rawtypes") NamedList args) {
|
||||
String keepOptimizedOnlyString = (String) args.get("keepOptimizedOnly");
|
||||
String maxCommitsToKeepString = (String) args.get("maxCommitsToKeep");
|
||||
String maxOptimizedCommitsToKeepString = (String) args.get("maxOptimizedCommitsToKeep");
|
||||
|
|
|
@ -505,13 +505,14 @@ public class SolrResourceLoader implements ResourceLoader, Closeable {
|
|||
}
|
||||
}
|
||||
|
||||
static final String empty[] = new String[0];
|
||||
static final String[] empty = new String[0];
|
||||
|
||||
@Override
|
||||
public <T> T newInstance(String name, Class<T> expectedType) {
|
||||
return newInstance(name, expectedType, empty);
|
||||
}
|
||||
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
private static final Class[] NO_CLASSES = new Class[0];
|
||||
private static final Object[] NO_OBJECTS = new Object[0];
|
||||
|
||||
|
@ -519,6 +520,7 @@ public class SolrResourceLoader implements ResourceLoader, Closeable {
|
|||
return newInstance(cname, expectedType, subpackages, NO_CLASSES, NO_OBJECTS);
|
||||
}
|
||||
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
public <T> T newInstance(String cName, Class<T> expectedType, String[] subPackages, Class[] params, Object[] args) {
|
||||
Class<? extends T> clazz = findClass(cName, expectedType, subPackages);
|
||||
if (clazz == null) {
|
||||
|
@ -687,12 +689,13 @@ public class SolrResourceLoader implements ResourceLoader, Closeable {
|
|||
/**
|
||||
* Keep a list of classes that are allowed to implement each 'Aware' interface
|
||||
*/
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
private static final Map<Class, Class[]> awareCompatibility;
|
||||
|
||||
static {
|
||||
awareCompatibility = new HashMap<>();
|
||||
awareCompatibility.put(
|
||||
SolrCoreAware.class, new Class[]{
|
||||
SolrCoreAware.class, new Class<?>[]{
|
||||
// DO NOT ADD THINGS TO THIS LIST -- ESPECIALLY THINGS THAT CAN BE CREATED DYNAMICALLY
|
||||
// VIA RUNTIME APIS -- UNTILL CAREFULLY CONSIDERING THE ISSUES MENTIONED IN SOLR-8311
|
||||
CodecFactory.class,
|
||||
|
@ -708,7 +711,7 @@ public class SolrResourceLoader implements ResourceLoader, Closeable {
|
|||
);
|
||||
|
||||
awareCompatibility.put(
|
||||
ResourceLoaderAware.class, new Class[]{
|
||||
ResourceLoaderAware.class, new Class<?>[]{
|
||||
// DO NOT ADD THINGS TO THIS LIST -- ESPECIALLY THINGS THAT CAN BE CREATED DYNAMICALLY
|
||||
// VIA RUNTIME APIS -- UNTILL CAREFULLY CONSIDERING THE ISSUES MENTIONED IN SOLR-8311
|
||||
CharFilterFactory.class,
|
||||
|
@ -723,6 +726,7 @@ public class SolrResourceLoader implements ResourceLoader, Closeable {
|
|||
/**
|
||||
* Utility function to throw an exception if the class is invalid
|
||||
*/
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
public static void assertAwareCompatibility(Class aware, Object obj) {
|
||||
Class[] valid = awareCompatibility.get(aware);
|
||||
if (valid == null) {
|
||||
|
|
|
@ -54,6 +54,7 @@ public class TransientSolrCoreCacheDefault extends TransientSolrCoreCache {
|
|||
// deprecate this for 7.0?
|
||||
this.cacheSize = cfg.getTransientCacheSize();
|
||||
} else {
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
NamedList args = cfg.getTransientCachePluginInfo().initArgs;
|
||||
Object obj = args.get("transientCacheSize");
|
||||
if (obj != null) {
|
||||
|
@ -69,6 +70,7 @@ public class TransientSolrCoreCacheDefault extends TransientSolrCoreCache {
|
|||
// Still handle just having transientCacheSize defined in the body of solr.xml not in a transient handler clause.
|
||||
this.cacheSize = cfg.getTransientCacheSize();
|
||||
} else {
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
NamedList args = cfg.getTransientCachePluginInfo().initArgs;
|
||||
Object obj = args.get("transientCacheSize");
|
||||
if (obj != null) {
|
||||
|
@ -105,6 +107,8 @@ public class TransientSolrCoreCacheDefault extends TransientSolrCoreCache {
|
|||
@Override
|
||||
public Collection<SolrCore> prepareForShutdown() {
|
||||
// Return a copy of the values
|
||||
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
List<SolrCore> ret = new ArrayList(transientCores.values());
|
||||
transientCores.clear();
|
||||
return ret;
|
||||
|
@ -129,7 +133,7 @@ public class TransientSolrCoreCacheDefault extends TransientSolrCoreCache {
|
|||
}
|
||||
|
||||
// Remove a core from the internal structures, presumably it
|
||||
// being closed. If the core is re-opened, it will be readded by CoreContainer.
|
||||
// being closed. If the core is re-opened, it will be re-added by CoreContainer.
|
||||
@Override
|
||||
public SolrCore removeCore(String name) {
|
||||
return transientCores.remove(name);
|
||||
|
|
|
@ -49,6 +49,7 @@ public class HdfsBackupRepository implements BackupRepository {
|
|||
private Configuration hdfsConfig = null;
|
||||
private FileSystem fileSystem = null;
|
||||
private Path baseHdfsPath = null;
|
||||
@SuppressWarnings("rawtypes")
|
||||
private NamedList config = null;
|
||||
protected int copyBufferSize = HdfsDirectory.DEFAULT_BUFFER_SIZE;
|
||||
|
||||
|
|
|
@ -46,10 +46,11 @@ import com.google.common.base.Preconditions;
|
|||
* interface e.g. NFS).
|
||||
*/
|
||||
public class LocalFileSystemRepository implements BackupRepository {
|
||||
@SuppressWarnings("rawtypes")
|
||||
private NamedList config = null;
|
||||
|
||||
@Override
|
||||
public void init(NamedList args) {
|
||||
public void init(@SuppressWarnings("rawtypes") NamedList args) {
|
||||
this.config = args;
|
||||
}
|
||||
|
||||
|
|
|
@ -169,6 +169,7 @@ public class SolrSnapshotManager {
|
|||
throws InterruptedException, KeeperException {
|
||||
String zkPath = getSnapshotMetaDataZkPath(collectionName, Optional.of(commitName));
|
||||
try {
|
||||
@SuppressWarnings({"unchecked"})
|
||||
Map<String, Object> data = (Map<String, Object>)Utils.fromJSON(zkClient.getData(zkPath, null, null, true));
|
||||
return Optional.of(new CollectionSnapshotMetaData(data));
|
||||
} catch (KeeperException ex) {
|
||||
|
@ -281,13 +282,14 @@ public class SolrSnapshotManager {
|
|||
* @param dir The index directory storing the snapshot.
|
||||
* @throws IOException in case of I/O errors.
|
||||
*/
|
||||
|
||||
@SuppressWarnings({"try", "unused"})
|
||||
private static void deleteSnapshotIndexFiles(SolrCore core, Directory dir, IndexDeletionPolicy delPolicy) throws IOException {
|
||||
IndexWriterConfig conf = core.getSolrConfig().indexConfig.toIndexWriterConfig(core);
|
||||
conf.setOpenMode(OpenMode.APPEND);
|
||||
conf.setMergePolicy(NoMergePolicy.INSTANCE);//Don't want to merge any commits here!
|
||||
conf.setIndexDeletionPolicy(delPolicy);
|
||||
conf.setCodec(core.getCodec());
|
||||
|
||||
try (SolrIndexWriter iw = new SolrIndexWriter("SolrSnapshotCleaner", dir, conf)) {
|
||||
// Do nothing. The only purpose of opening index writer is to invoke the Lucene IndexDeletionPolicy#onInit
|
||||
// method so that we can cleanup the files associated with specified index commit.
|
||||
|
|
|
@ -426,6 +426,7 @@ public class SolrSnapshotsTool implements Closeable, CLIO {
|
|||
return false;
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
private Collection<CollectionSnapshotMetaData> listCollectionSnapshots(String collectionName)
|
||||
throws SolrServerException, IOException {
|
||||
CollectionAdminRequest.ListSnapshots listSnapshots = new CollectionAdminRequest.ListSnapshots(collectionName);
|
||||
|
|
|
@ -114,7 +114,7 @@ public class CoreAdminHandler extends RequestHandlerBase implements PermissionNa
|
|||
|
||||
|
||||
@Override
|
||||
final public void init(NamedList args) {
|
||||
final public void init(@SuppressWarnings({"rawtypes"})NamedList args) {
|
||||
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,
|
||||
"CoreAdminHandler should not be configured in solrconf.xml\n" +
|
||||
"it is a special Handler configured directly by the RequestDispatcher");
|
||||
|
|
|
@ -196,9 +196,10 @@ public abstract class SolrCoreState {
|
|||
|
||||
public abstract void setCdcrBootstrapFuture(Future<Boolean> cdcrBootstrapFuture);
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public abstract Callable getCdcrBootstrapCallable();
|
||||
|
||||
public abstract void setCdcrBootstrapCallable(Callable cdcrBootstrapCallable);
|
||||
public abstract void setCdcrBootstrapCallable(@SuppressWarnings("rawtypes") Callable cdcrBootstrapCallable);
|
||||
|
||||
public Throwable getTragicException() throws IOException {
|
||||
RefCounted<IndexWriter> ref = getIndexWriter(null);
|
||||
|
|
Loading…
Reference in New Issue