diff --git a/solr/core/src/java/org/apache/solr/cluster/events/ClusterEvent.java b/solr/core/src/java/org/apache/solr/cluster/events/ClusterEvent.java
index f2fb184fb079..c800ce8b6f0c 100644
--- a/solr/core/src/java/org/apache/solr/cluster/events/ClusterEvent.java
+++ b/solr/core/src/java/org/apache/solr/cluster/events/ClusterEvent.java
@@ -32,8 +32,8 @@ enum EventType {
COLLECTIONS_REMOVED,
/** Cluster properties have changed. */
CLUSTER_PROPERTIES_CHANGED
- // other types? eg. Overseer leader change, shard leader change,
- // node overload (eg. CPU / MEM circuit breakers tripped)?
+ // other types? e.g. Overseer leader change, shard leader change,
+ // node overload (e.g. CPU / MEM circuit breakers tripped)?
}
/** Get event type. */
diff --git a/solr/core/src/java/org/apache/solr/cluster/events/ClusterEventProducerBase.java b/solr/core/src/java/org/apache/solr/cluster/events/ClusterEventProducerBase.java
index ee16baf41fe0..376d331c07dd 100644
--- a/solr/core/src/java/org/apache/solr/cluster/events/ClusterEventProducerBase.java
+++ b/solr/core/src/java/org/apache/solr/cluster/events/ClusterEventProducerBase.java
@@ -84,9 +84,7 @@ public State getState() {
@Override
public void close() throws IOException {
synchronized (listeners) {
- listeners
- .values()
- .forEach(listenerSet -> listenerSet.forEach(listener -> IOUtils.closeQuietly(listener)));
+ listeners.values().forEach(listenerSet -> listenerSet.forEach(IOUtils::closeQuietly));
}
}
diff --git a/solr/core/src/java/org/apache/solr/cluster/events/impl/ClusterEventProducerFactory.java b/solr/core/src/java/org/apache/solr/cluster/events/impl/ClusterEventProducerFactory.java
index e7401940ad7d..e7f57cbcca99 100644
--- a/solr/core/src/java/org/apache/solr/cluster/events/impl/ClusterEventProducerFactory.java
+++ b/solr/core/src/java/org/apache/solr/cluster/events/impl/ClusterEventProducerFactory.java
@@ -93,13 +93,13 @@ public ContainerPluginsRegistry.PluginRegistryListener getPluginRegistryListener
/**
* Create a {@link ClusterEventProducer} based on the current plugin configurations.
*
- *
NOTE: this method can only be called once because it has side-effects, such as transferring
+ *
NOTE: this method can only be called once because it has side effects, such as transferring
* the initially collected listeners to the resulting producer's instance, and installing a {@link
* org.apache.solr.api.ContainerPluginsRegistry.PluginRegistryListener}. Calling this method more
* than once will result in an exception.
*
* @param plugins current plugin configurations
- * @return configured instance of cluster event producer (with side-effects, see above)
+ * @return configured instance of cluster event producer (with side effects, see above)
*/
public DelegatingClusterEventProducer create(ContainerPluginsRegistry plugins) {
if (created) {
@@ -201,9 +201,8 @@ private void transferListeners(ClusterEventProducer target, ContainerPluginsRegi
plugins.unregisterListener(initialPluginListener);
// transfer listeners that are already registered
listeners.forEach(
- (type, listenersSet) -> {
- listenersSet.forEach(listener -> target.registerListener(listener, type));
- });
+ (type, listenersSet) ->
+ listenersSet.forEach(listener -> target.registerListener(listener, type)));
listeners.clear();
}
}
diff --git a/solr/core/src/java/org/apache/solr/cluster/events/impl/CollectionsRepairEventListener.java b/solr/core/src/java/org/apache/solr/cluster/events/impl/CollectionsRepairEventListener.java
index 0d8c26d6c060..134e3d075e73 100644
--- a/solr/core/src/java/org/apache/solr/cluster/events/impl/CollectionsRepairEventListener.java
+++ b/solr/core/src/java/org/apache/solr/cluster/events/impl/CollectionsRepairEventListener.java
@@ -195,10 +195,7 @@ private void runRepair() {
newPositions.put(coll.getName(), positions);
} catch (Exception e) {
log.warn(
- "Exception computing positions for {}/{}: {}",
- coll.getName(),
- shard,
- e);
+ "Exception computing positions for {}/{}", coll.getName(), shard, e);
}
});
});
@@ -229,8 +226,7 @@ private void runRepair() {
try {
solrClient.request(addReplica);
} catch (Exception e) {
- log.warn(
- "Exception calling ADDREPLICA {}: {}", addReplica.getParams().toQueryString(), e);
+ log.warn("Exception calling ADDREPLICA {}", addReplica.getParams().toQueryString(), e);
}
});
}
diff --git a/solr/core/src/java/org/apache/solr/cluster/events/impl/DelegatingClusterEventProducer.java b/solr/core/src/java/org/apache/solr/cluster/events/impl/DelegatingClusterEventProducer.java
index 551b9bfd397c..61fffdf5c98f 100644
--- a/solr/core/src/java/org/apache/solr/cluster/events/impl/DelegatingClusterEventProducer.java
+++ b/solr/core/src/java/org/apache/solr/cluster/events/impl/DelegatingClusterEventProducer.java
@@ -96,7 +96,7 @@ public void setDelegate(ClusterEventProducer newDelegate) {
log.debug("--- started delegate {}", delegate);
}
} catch (Exception e) {
- log.warn("Unable to start the new delegate {}: {}", delegate.getClass().getName(), e);
+ log.warn("Unable to start the new delegate {}", delegate.getClass().getName(), e);
}
} else {
if (log.isDebugEnabled()) {
diff --git a/solr/core/src/java/org/apache/solr/cluster/placement/AttributeFetcher.java b/solr/core/src/java/org/apache/solr/cluster/placement/AttributeFetcher.java
index a751d4bc08de..09186a0afa6d 100644
--- a/solr/core/src/java/org/apache/solr/cluster/placement/AttributeFetcher.java
+++ b/solr/core/src/java/org/apache/solr/cluster/placement/AttributeFetcher.java
@@ -65,7 +65,7 @@ AttributeFetcher requestCollectionMetrics(
/**
* Fetches all requested node attributes from all nodes passed to {@link #fetchFrom(Set)} as well
* as non-node attributes (those requested using e.g. {@link
- * #requestCollectionMetrics(SolrCollection, Set)}.
+ * #requestCollectionMetrics(SolrCollection, Set)}).
*
* @return An instance allowing retrieval of all attributes that could be fetched.
*/
diff --git a/solr/core/src/java/org/apache/solr/cluster/placement/BalanceRequest.java b/solr/core/src/java/org/apache/solr/cluster/placement/BalanceRequest.java
index f967b7fa8080..9dfb0ee56e15 100644
--- a/solr/core/src/java/org/apache/solr/cluster/placement/BalanceRequest.java
+++ b/solr/core/src/java/org/apache/solr/cluster/placement/BalanceRequest.java
@@ -43,6 +43,4 @@ public interface BalanceRequest extends ModificationRequest {
* the error itself rather than calling the plugin).
*/
Set getNodes();
-
- int getMaximumBalanceSkew();
}
diff --git a/solr/core/src/java/org/apache/solr/cluster/placement/CollectionMetrics.java b/solr/core/src/java/org/apache/solr/cluster/placement/CollectionMetrics.java
index c6afc8b480d2..d0a8681ccd5f 100644
--- a/solr/core/src/java/org/apache/solr/cluster/placement/CollectionMetrics.java
+++ b/solr/core/src/java/org/apache/solr/cluster/placement/CollectionMetrics.java
@@ -21,7 +21,7 @@
import java.util.Optional;
/**
- * Collection-level metrics. Currently this class is a container just for shard-level metrics but
+ * Collection-level metrics. Currently, this class is a container just for shard-level metrics but
* future versions may add other primitive collection-level metrics.
*/
public interface CollectionMetrics {
diff --git a/solr/core/src/java/org/apache/solr/cluster/placement/Metric.java b/solr/core/src/java/org/apache/solr/cluster/placement/Metric.java
index afa1040b96a9..5ddd0d0d4561 100644
--- a/solr/core/src/java/org/apache/solr/cluster/placement/Metric.java
+++ b/solr/core/src/java/org/apache/solr/cluster/placement/Metric.java
@@ -23,7 +23,7 @@
*/
public interface Metric {
- /** Return the short-hand name that identifies this attribute. */
+ /** Return the shorthand name that identifies this attribute. */
String getName();
/** Return the internal name of a Solr metric associated with this attribute. */
diff --git a/solr/core/src/java/org/apache/solr/cluster/placement/PlacementContext.java b/solr/core/src/java/org/apache/solr/cluster/placement/PlacementContext.java
index be7b0282a790..ae161610e609 100644
--- a/solr/core/src/java/org/apache/solr/cluster/placement/PlacementContext.java
+++ b/solr/core/src/java/org/apache/solr/cluster/placement/PlacementContext.java
@@ -33,7 +33,7 @@ public interface PlacementContext {
/**
* Factory used by the plugin to fetch additional attributes from the cluster nodes, such as count
- * of cores, system properties etc..
+ * of cores, system properties etc.
*/
AttributeFetcher getAttributeFetcher();
diff --git a/solr/core/src/java/org/apache/solr/cluster/placement/PlacementException.java b/solr/core/src/java/org/apache/solr/cluster/placement/PlacementException.java
index bbe49f627463..c50b667ee52b 100644
--- a/solr/core/src/java/org/apache/solr/cluster/placement/PlacementException.java
+++ b/solr/core/src/java/org/apache/solr/cluster/placement/PlacementException.java
@@ -39,9 +39,4 @@ public PlacementException(String message, Throwable cause) {
public PlacementException(Throwable cause) {
super(cause);
}
-
- protected PlacementException(
- String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
- super(message, cause, enableSuppression, writableStackTrace);
- }
}
diff --git a/solr/core/src/java/org/apache/solr/cluster/placement/PlacementModificationException.java b/solr/core/src/java/org/apache/solr/cluster/placement/PlacementModificationException.java
index 30439188a228..cd780d83bcfe 100644
--- a/solr/core/src/java/org/apache/solr/cluster/placement/PlacementModificationException.java
+++ b/solr/core/src/java/org/apache/solr/cluster/placement/PlacementModificationException.java
@@ -27,10 +27,6 @@
public class PlacementModificationException extends PlacementException {
private final Map rejectedModifications = new HashMap<>();
- public PlacementModificationException() {
- super();
- }
-
public PlacementModificationException(String message) {
super(message);
}
@@ -39,10 +35,6 @@ public PlacementModificationException(String message, Throwable cause) {
super(message, cause);
}
- public PlacementModificationException(Throwable cause) {
- super(cause);
- }
-
/**
* Add information about the modification that cause this exception.
*
diff --git a/solr/core/src/java/org/apache/solr/cluster/placement/PlacementPlugin.java b/solr/core/src/java/org/apache/solr/cluster/placement/PlacementPlugin.java
index d2924d344b86..6bc14205f2e2 100644
--- a/solr/core/src/java/org/apache/solr/cluster/placement/PlacementPlugin.java
+++ b/solr/core/src/java/org/apache/solr/cluster/placement/PlacementPlugin.java
@@ -98,5 +98,5 @@ BalancePlan computeBalancing(BalanceRequest balanceRequest, PlacementContext pla
*/
default void verifyAllowedModification(
ModificationRequest modificationRequest, PlacementContext placementContext)
- throws PlacementException, InterruptedException {}
+ throws PlacementException {}
}
diff --git a/solr/core/src/java/org/apache/solr/cluster/placement/ShardMetrics.java b/solr/core/src/java/org/apache/solr/cluster/placement/ShardMetrics.java
index 0ca45267ff02..3be201f1d6fd 100644
--- a/solr/core/src/java/org/apache/solr/cluster/placement/ShardMetrics.java
+++ b/solr/core/src/java/org/apache/solr/cluster/placement/ShardMetrics.java
@@ -20,7 +20,7 @@
import java.util.Optional;
/**
- * Shard-level metrics. Currently this is just a container for replica-level metrics but future
+ * Shard-level metrics. Currently, this is just a container for replica-level metrics but future
* versions may add other primitive shard-level metrics.
*/
public interface ShardMetrics {
diff --git a/solr/core/src/java/org/apache/solr/cluster/placement/impl/AttributeFetcherImpl.java b/solr/core/src/java/org/apache/solr/cluster/placement/impl/AttributeFetcherImpl.java
index 2aa4203f91af..cca227000f74 100644
--- a/solr/core/src/java/org/apache/solr/cluster/placement/impl/AttributeFetcherImpl.java
+++ b/solr/core/src/java/org/apache/solr/cluster/placement/impl/AttributeFetcherImpl.java
@@ -101,7 +101,7 @@ public AttributeValues fetchAttributes() {
// In order to match the returned values for the various snitches, we need to keep track of
// where each received value goes. Given the target maps are of different types (the maps from
// Node to whatever defined above) we instead pass a function taking two arguments, the node and
- // the (non null) returned value, that will cast the value into the appropriate type for the
+ // the (non-null) returned value, that will cast the value into the appropriate type for the
// snitch tag and insert it into the appropriate map with the node as the key.
for (String sysPropSnitch : requestedNodeSystemSnitchTags) {
systemSnitchToNodeToValue.put(sysPropSnitch, new HashMap<>());
@@ -207,11 +207,10 @@ private void fetchNodeValues(
Map> systemSnitchToNodeToValue,
Map, Map> metricSnitchToNodeToValue) {
- Set allRequestedTags = new HashSet<>();
Map> tagToMetric = new HashMap<>();
// Add system property tags we need to request
- allRequestedTags.addAll(requestedNodeSystemSnitchTags);
+ Set allRequestedTags = new HashSet<>(requestedNodeSystemSnitchTags);
// Add metric tags we need to request
for (NodeMetric> metric : requestedNodeMetricSnitchTags) {
diff --git a/solr/core/src/java/org/apache/solr/cluster/placement/impl/BalanceRequestImpl.java b/solr/core/src/java/org/apache/solr/cluster/placement/impl/BalanceRequestImpl.java
index 95454f9dbbea..4a2f39ba8ebb 100644
--- a/solr/core/src/java/org/apache/solr/cluster/placement/impl/BalanceRequestImpl.java
+++ b/solr/core/src/java/org/apache/solr/cluster/placement/impl/BalanceRequestImpl.java
@@ -45,11 +45,6 @@ public Set getNodes() {
return nodes;
}
- @Override
- public int getMaximumBalanceSkew() {
- return maximumBalanceSkew;
- }
-
@Override
public SolrCollection getCollection() {
return solrCollection;
diff --git a/solr/core/src/java/org/apache/solr/cluster/placement/impl/MetricImpl.java b/solr/core/src/java/org/apache/solr/cluster/placement/impl/MetricImpl.java
index b3c5782bd13c..f6a64d8eb516 100644
--- a/solr/core/src/java/org/apache/solr/cluster/placement/impl/MetricImpl.java
+++ b/solr/core/src/java/org/apache/solr/cluster/placement/impl/MetricImpl.java
@@ -68,7 +68,7 @@ public abstract class MetricImpl implements Metric {
/**
* Create a metric attribute.
*
- * @param name short-hand name that identifies this attribute.
+ * @param name shorthand name that identifies this attribute.
* @param internalName internal name of a Solr metric.
*/
public MetricImpl(String name, String internalName) {
@@ -78,7 +78,7 @@ public MetricImpl(String name, String internalName) {
/**
* Create a metric attribute.
*
- * @param name short-hand name that identifies this attribute.
+ * @param name shorthand name that identifies this attribute.
* @param internalName internal name of a Solr metric.
* @param converter optional raw value converter. If null then {@link #IDENTITY_CONVERTER} will be
* used.
@@ -90,7 +90,7 @@ public MetricImpl(String name, String internalName, Function