lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject [lucene-solr] 29/36: Update the API to the current master.
Date Wed, 18 Dec 2019 16:39:07 GMT
This is an automated email from the ASF dual-hosted git repository.

ab pushed a commit to branch jira/solr-13579
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git

commit b103faa866e6339b7a79a3196947e98a6cdf62c0
Author: Andrzej Bialecki <ab@apache.org>
AuthorDate: Mon Nov 18 16:29:01 2019 +0100

    Update the API to the current master.
---
 .../java/org/apache/solr/core/CoreContainer.java   |  1 -
 .../DefaultResourceManagerPluginFactory.java       |  4 +--
 .../solr/managed/DefaultResourceManagerPool.java   | 38 ++++------------------
 .../apache/solr/managed/ManagedComponentId.java    | 19 ++++++++---
 .../apache/solr/managed/NoOpResourceManager.java   |  7 +++-
 .../apache/solr/managed/ResourceManagerPlugin.java | 28 ++++++++++++++++
 .../apache/solr/managed/ResourceManagerPool.java   |  4 +--
 .../solr/managed/types/CacheManagerPlugin.java     | 30 ++++++++---------
 .../solr/managed/types/ManagedCacheComponent.java  | 22 -------------
 .../apache/solr/managed/types/package-info.java    |  3 +-
 .../java/org/apache/solr/search/CaffeineCache.java | 14 +++++++-
 .../src/java/org/apache/solr/search/SolrCache.java | 18 ++++++++--
 .../org/apache/solr/search/SolrCacheHolder.java    | 10 ------
 .../managed/TestDefaultResourceManagerPool.java    | 16 ++++-----
 14 files changed, 113 insertions(+), 101 deletions(-)

diff --git a/solr/core/src/java/org/apache/solr/core/CoreContainer.java b/solr/core/src/java/org/apache/solr/core/CoreContainer.java
index 20a6914..e969f11 100644
--- a/solr/core/src/java/org/apache/solr/core/CoreContainer.java
+++ b/solr/core/src/java/org/apache/solr/core/CoreContainer.java
@@ -234,7 +234,6 @@ public class CoreContainer {
 
   protected volatile ResourceManagerHandler resourceManagerHandler;
 
-  private final LibListener clusterPropertiesListener = new LibListener(this);
   private PackageStoreAPI packageStoreAPI;
   private PackageLoader packageLoader;
 
diff --git a/solr/core/src/java/org/apache/solr/managed/DefaultResourceManagerPluginFactory.java
b/solr/core/src/java/org/apache/solr/managed/DefaultResourceManagerPluginFactory.java
index 07eb5ad..0f5cf79 100644
--- a/solr/core/src/java/org/apache/solr/managed/DefaultResourceManagerPluginFactory.java
+++ b/solr/core/src/java/org/apache/solr/managed/DefaultResourceManagerPluginFactory.java
@@ -23,7 +23,7 @@ import java.util.Map;
 
 import org.apache.solr.core.SolrResourceLoader;
 import org.apache.solr.managed.types.CacheManagerPlugin;
-import org.apache.solr.managed.types.ManagedCacheComponent;
+import org.apache.solr.search.SolrCache;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -41,7 +41,7 @@ public class DefaultResourceManagerPluginFactory implements ResourceManagerPlugi
 
   static {
     typeToPluginClass.put(CacheManagerPlugin.TYPE, CacheManagerPlugin.class);
-    typeToComponentClass.put(CacheManagerPlugin.TYPE, ManagedCacheComponent.class);
+    typeToComponentClass.put(CacheManagerPlugin.TYPE, SolrCache.class);
   }
 
   private final SolrResourceLoader loader;
diff --git a/solr/core/src/java/org/apache/solr/managed/DefaultResourceManagerPool.java b/solr/core/src/java/org/apache/solr/managed/DefaultResourceManagerPool.java
index 1f1e6d2..07eb5bf 100644
--- a/solr/core/src/java/org/apache/solr/managed/DefaultResourceManagerPool.java
+++ b/solr/core/src/java/org/apache/solr/managed/DefaultResourceManagerPool.java
@@ -31,7 +31,7 @@ import org.slf4j.LoggerFactory;
 
 /**
  * This class manages a pool of resources of the same type, which use the same
- * {@link ResourceManagerPlugin} for managing their resource limits.
+ * {@link ResourceManagerPlugin} implementation for managing their resource limits.
  */
 public class DefaultResourceManagerPool implements ResourceManagerPool {
   private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
@@ -44,7 +44,7 @@ public class DefaultResourceManagerPool implements ResourceManagerPool {
   private final ResourceManagerPlugin resourceManagerPlugin;
   private final Map<String, Object> args;
   private final ManagedContext poolContext = new ManagedContext();
-  private Map<String, Float> totalValues = null;
+  private Map<String, Map<String, Object>> currentValues = null;
   private final ReentrantLock updateLock = new ReentrantLock();
   int scheduleDelaySeconds;
   ScheduledFuture<?> scheduledFuture;
@@ -119,34 +119,15 @@ public class DefaultResourceManagerPool implements ResourceManagerPool
{
     updateLock.lockInterruptibly();
     try {
       // collect the current values
-      Map<String, Map<String, Object>> currentValues = new HashMap<>();
+      Map<String, Map<String, Object>> newCurrentValues = new HashMap<>();
       for (ManagedComponent managedComponent : components.values()) {
         try {
-          currentValues.put(managedComponent.getManagedComponentId().toString(), resourceManagerPlugin.getMonitoredValues(managedComponent));
+          newCurrentValues.put(managedComponent.getManagedComponentId().toString(), resourceManagerPlugin.getMonitoredValues(managedComponent));
         } catch (Exception e) {
           log.warn("Error getting managed values from " + managedComponent.getManagedComponentId(),
e);
         }
       }
-      // calculate the totals
-      Map<String, Float> newTotalValues = new HashMap<>();
-      currentValues.values().forEach(map -> map.forEach((k, v) -> {
-        // only calculate totals for numbers
-        if (!(v instanceof Number)) {
-          return;
-        }
-        Float val = ((Number)v).floatValue();
-        // -1 and MAX_VALUE are our special guard values
-        if (val < 0 || val.longValue() == Long.MAX_VALUE || val.longValue() == Integer.MAX_VALUE)
{
-          return;
-        }
-        Float total = newTotalValues.get(k);
-        if (total == null) {
-          newTotalValues.put(k, val);
-        } else {
-          newTotalValues.put(k, total + val);
-        }
-      }));
-      totalValues = newTotalValues;
+      this.currentValues = newCurrentValues;
       return Collections.unmodifiableMap(currentValues);
     } finally {
       updateLock.unlock();
@@ -154,13 +135,8 @@ public class DefaultResourceManagerPool implements ResourceManagerPool
{
   }
 
   @Override
-  public Map<String, Number> getTotalValues() throws InterruptedException {
-    updateLock.lockInterruptibly();
-    try {
-      return Collections.unmodifiableMap(totalValues);
-    } finally {
-      updateLock.unlock();
-    }
+  public Map<String, Object> getTotalValues() throws InterruptedException {
+    return Collections.unmodifiableMap(resourceManagerPlugin.aggregateTotalValues(currentValues));
   }
 
   @Override
diff --git a/solr/core/src/java/org/apache/solr/managed/ManagedComponentId.java b/solr/core/src/java/org/apache/solr/managed/ManagedComponentId.java
index d5feda2..bd09080 100644
--- a/solr/core/src/java/org/apache/solr/managed/ManagedComponentId.java
+++ b/solr/core/src/java/org/apache/solr/managed/ManagedComponentId.java
@@ -19,8 +19,6 @@ package org.apache.solr.managed;
 
 import java.util.Arrays;
 
-import org.apache.solr.metrics.SolrMetricManager;
-
 /**
  * Hierarchical component id.
  */
@@ -32,7 +30,20 @@ public class ManagedComponentId {
   public ManagedComponentId(String name, String... path) {
     this.name = name;
     this.path = path;
-    this.id = SolrMetricManager.mkName(name, path);
+    StringBuilder sb = new StringBuilder();
+    if (path != null) {
+      for (String pathEl : path) {
+        if (sb.length() > 0) {
+          sb.append(':');
+        }
+        sb.append(pathEl);
+      }
+    }
+    if (sb.length() > 0) {
+      sb.append(':');
+    }
+    sb.append(name);
+    id = sb.toString();
   }
 
   public String getName() {
@@ -51,7 +62,7 @@ public class ManagedComponentId {
     if (fullName == null || fullName.isEmpty()) {
       return null;
     }
-    String[] parts = fullName.split("\\.");
+    String[] parts = fullName.split(":");
     if (parts.length > 1) {
       String name = parts[parts.length - 1];
       String[] path = Arrays.copyOfRange(parts, 0, parts.length - 1);
diff --git a/solr/core/src/java/org/apache/solr/managed/NoOpResourceManager.java b/solr/core/src/java/org/apache/solr/managed/NoOpResourceManager.java
index bf43cb1..d828a4f 100644
--- a/solr/core/src/java/org/apache/solr/managed/NoOpResourceManager.java
+++ b/solr/core/src/java/org/apache/solr/managed/NoOpResourceManager.java
@@ -103,6 +103,11 @@ public class NoOpResourceManager extends ResourceManager {
     }
 
     @Override
+    public boolean isRegistered(String componentId) {
+      return false;
+    }
+
+    @Override
     public Map<String, ManagedComponent> getComponents() {
       return Collections.emptyMap();
     }
@@ -113,7 +118,7 @@ public class NoOpResourceManager extends ResourceManager {
     }
 
     @Override
-    public Map<String, Number> getTotalValues() throws InterruptedException {
+    public Map<String, Object> getTotalValues() throws InterruptedException {
       return Collections.emptyMap();
     }
 
diff --git a/solr/core/src/java/org/apache/solr/managed/ResourceManagerPlugin.java b/solr/core/src/java/org/apache/solr/managed/ResourceManagerPlugin.java
index 592ba03..1fbeaf0 100644
--- a/solr/core/src/java/org/apache/solr/managed/ResourceManagerPlugin.java
+++ b/solr/core/src/java/org/apache/solr/managed/ResourceManagerPlugin.java
@@ -17,6 +17,7 @@
 package org.apache.solr.managed;
 
 import java.util.Collection;
+import java.util.HashMap;
 import java.util.Map;
 
 /**
@@ -40,6 +41,11 @@ public interface ResourceManagerPlugin<T extends ManagedComponent>
{
    */
   Collection<String> getControlledParams();
 
+  /**
+   * Return current values of monitored parameters. Note: the resulting map may contain also
+   * other implementation-specific parameter values.
+   * @param component monitored component
+   */
   Map<String, Object> getMonitoredValues(T component) throws Exception;
 
   default void setResourceLimits(T component, Map<String, Object> limits) throws Exception
{
@@ -62,4 +68,26 @@ public interface ResourceManagerPlugin<T extends ManagedComponent>
{
    */
   void manage(ResourceManagerPool pool) throws Exception;
 
+  /**
+   * Aggregated current monitored values.
+   * <p>Default implementation of this method simply sums up all non-negative numeric
values across
+   * components and ignores any non-numeric values.</p>
+   */
+  default Map<String, Object> aggregateTotalValues(Map<String, Map<String, Object>>
perComponentValues) {
+    // calculate the totals
+    Map<String, Object> newTotalValues = new HashMap<>();
+    perComponentValues.values().forEach(map -> map.forEach((k, v) -> {
+      // only calculate totals for numbers
+      if (!(v instanceof Number)) {
+        return;
+      }
+      Double val = ((Number)v).doubleValue();
+      // -1 and MAX_VALUE are our special guard values
+      if (val < 0 || val.longValue() == Long.MAX_VALUE || val.longValue() == Integer.MAX_VALUE)
{
+        return;
+      }
+      newTotalValues.merge(k, val, (v1, v2) -> ((Number)v1).doubleValue() + ((Number)v2).doubleValue());
+    }));
+    return newTotalValues;
+  }
 }
diff --git a/solr/core/src/java/org/apache/solr/managed/ResourceManagerPool.java b/solr/core/src/java/org/apache/solr/managed/ResourceManagerPool.java
index 0761442..2bf4db7 100644
--- a/solr/core/src/java/org/apache/solr/managed/ResourceManagerPool.java
+++ b/solr/core/src/java/org/apache/solr/managed/ResourceManagerPool.java
@@ -40,9 +40,9 @@ public interface ResourceManagerPool extends Runnable, Closeable {
 
   /**
    * This returns cumulative monitored values of all components.
-   * <p>NOTE: you must call {@link #getCurrentValues()} first!</p>
+   * <p>NOTE: you MUST call {@link #getCurrentValues()} first!</p>
    */
-  Map<String, Number> getTotalValues() throws InterruptedException;
+  Map<String, Object> getTotalValues() throws InterruptedException;
 
   /** Get current pool limits. */
   Map<String, Object> getPoolLimits();
diff --git a/solr/core/src/java/org/apache/solr/managed/types/CacheManagerPlugin.java b/solr/core/src/java/org/apache/solr/managed/types/CacheManagerPlugin.java
index 6cd581b..4956c58 100644
--- a/solr/core/src/java/org/apache/solr/managed/types/CacheManagerPlugin.java
+++ b/solr/core/src/java/org/apache/solr/managed/types/CacheManagerPlugin.java
@@ -37,7 +37,7 @@ import org.slf4j.LoggerFactory;
  * which can be adjusted using configuration parameter {@link #DEAD_BAND}. If monitored values
don't
  * exceed the limits +/- the dead band then no action is taken.</p>
  */
-public class CacheManagerPlugin implements ResourceManagerPlugin<ManagedCacheComponent>
{
+public class CacheManagerPlugin implements ResourceManagerPlugin<SolrCache> {
   private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
 
   public static String TYPE = "cache";
@@ -76,7 +76,7 @@ public class CacheManagerPlugin implements ResourceManagerPlugin<ManagedCacheCom
   }
 
   @Override
-  public void setResourceLimit(ManagedCacheComponent component, String limitName, Object
val) {
+  public void setResourceLimit(SolrCache component, String limitName, Object val) {
     if (!(val instanceof Number)) {
       try {
         val = Long.parseLong(String.valueOf(val));
@@ -101,7 +101,7 @@ public class CacheManagerPlugin implements ResourceManagerPlugin<ManagedCacheCom
   }
 
   @Override
-  public Map<String, Object> getResourceLimits(ManagedCacheComponent component) {
+  public Map<String, Object> getResourceLimits(SolrCache component) {
     Map<String, Object> limits = new HashMap<>();
     limits.put(SolrCache.MAX_SIZE_PARAM, component.getMaxSize());
     limits.put(SolrCache.MAX_RAM_MB_PARAM, component.getMaxRamMB());
@@ -109,12 +109,8 @@ public class CacheManagerPlugin implements ResourceManagerPlugin<ManagedCacheCom
   }
 
   @Override
-  public Map<String, Object> getMonitoredValues(ManagedCacheComponent component) throws
Exception {
-    Map<String, Object> values = new HashMap<>();
-    values.put(SolrCache.HIT_RATIO_PARAM, component.getHitRatio());
-    values.put(SolrCache.RAM_BYTES_USED_PARAM, component.ramBytesUsed());
-    values.put(SolrCache.SIZE_PARAM, component.getSize());
-    return values;
+  public Map<String, Object> getMonitoredValues(SolrCache component) throws Exception
{
+    return component.getSolrMetricsContext().getMetricsSnapshot();
   }
 
   @Override
@@ -135,7 +131,7 @@ public class CacheManagerPlugin implements ResourceManagerPlugin<ManagedCacheCom
   @Override
   public void manage(ResourceManagerPool pool) throws Exception {
     Map<String, Map<String, Object>> currentValues = pool.getCurrentValues();
-    Map<String, Number> totalValues = pool.getTotalValues();
+    Map<String, Object> totalValues = pool.getTotalValues();
     // pool limits are defined using controlled tags
     pool.getPoolLimits().forEach((poolLimitName, value) -> {
       // only numeric limits are supported
@@ -150,8 +146,12 @@ public class CacheManagerPlugin implements ResourceManagerPlugin<ManagedCacheCom
       if (monitoredTag == null) {
         return;
       }
-      Number totalValue = totalValues.get(monitoredTag);
-      if (totalValue == null || totalValue.floatValue() <= 0.0f) {
+      Object tv = totalValues.get(monitoredTag);
+      if (tv == null || !(tv instanceof Number)) {
+        return;
+      }
+      Number totalValue = (Number) tv;
+      if (totalValue.floatValue() <= 0.0f) {
         return;
       }
       float totalDelta = poolLimitValue - totalValue.floatValue();
@@ -164,7 +164,7 @@ public class CacheManagerPlugin implements ResourceManagerPlugin<ManagedCacheCom
       float changeRatio = poolLimitValue / totalValue.floatValue();
       // modify current limits by the changeRatio
       pool.getComponents().forEach((name, component) -> {
-        Map<String, Object> resourceLimits = getResourceLimits((ManagedCacheComponent)component);
+        Map<String, Object> resourceLimits = getResourceLimits((SolrCache) component);
         Object limit = resourceLimits.get(poolLimitName);
         // XXX we could attempt here to control eg. ramBytesUsed by adjusting maxSize limit
         // XXX and vice versa if the current limit is undefined or unsupported
@@ -172,12 +172,12 @@ public class CacheManagerPlugin implements ResourceManagerPlugin<ManagedCacheCom
           return;
         }
         float currentResourceLimit = ((Number)limit).floatValue();
-        if (currentResourceLimit <= 0) {
+        if (currentResourceLimit <= 0) { // undefined or unsupported
           return;
         }
         float newLimit = currentResourceLimit * changeRatio;
         try {
-          setResourceLimit((ManagedCacheComponent)component, poolLimitName, newLimit);
+          setResourceLimit((SolrCache) component, poolLimitName, newLimit);
         } catch (Exception e) {
           log.warn("Failed to set managed limit " + poolLimitName +
               " from " + currentResourceLimit + " to " + newLimit + " on " + component.getManagedComponentId(),
e);
diff --git a/solr/core/src/java/org/apache/solr/managed/types/ManagedCacheComponent.java b/solr/core/src/java/org/apache/solr/managed/types/ManagedCacheComponent.java
deleted file mode 100644
index d36a842..0000000
--- a/solr/core/src/java/org/apache/solr/managed/types/ManagedCacheComponent.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package org.apache.solr.managed.types;
-
-import org.apache.lucene.util.Accountable;
-import org.apache.solr.managed.ManagedComponent;
-
-/**
- *
- */
-public interface ManagedCacheComponent extends ManagedComponent, Accountable {
-  /** Set maximum cache size limit (number of items). */
-  void setMaxSize(int size);
-  /** Set maximum cache size limit (in MB of RAM). */
-  void setMaxRamMB(int maxRamMB);
-  /** Get the configured maximum size limit (number of items). */
-  int getMaxSize();
-  /** Get the configured maximym size limit (in MB of RAM). */
-  int getMaxRamMB();
-  /** Get the current number of items in cache. */
-  int getSize();
-  /** Get the ratio of hits to lookups. */
-  float getHitRatio();
-}
diff --git a/solr/core/src/java/org/apache/solr/managed/types/package-info.java b/solr/core/src/java/org/apache/solr/managed/types/package-info.java
index 5dd0a71..a7dde4d 100644
--- a/solr/core/src/java/org/apache/solr/managed/types/package-info.java
+++ b/solr/core/src/java/org/apache/solr/managed/types/package-info.java
@@ -16,6 +16,7 @@
  */
 
 /**
- * Implementations of {@link org.apache.solr.managed.ResourceManagerPlugin}.
+ * Implementations of {@link org.apache.solr.managed.ResourceManagerPlugin} specialized for
+ * particular types of objects.
  */
 package org.apache.solr.managed.types;
diff --git a/solr/core/src/java/org/apache/solr/search/CaffeineCache.java b/solr/core/src/java/org/apache/solr/search/CaffeineCache.java
index 82271ad..32837f6 100644
--- a/solr/core/src/java/org/apache/solr/search/CaffeineCache.java
+++ b/solr/core/src/java/org/apache/solr/search/CaffeineCache.java
@@ -37,6 +37,8 @@ import com.github.benmanes.caffeine.cache.RemovalListener;
 import org.apache.lucene.util.Accountable;
 import org.apache.lucene.util.RamUsageEstimator;
 import org.apache.solr.common.SolrException;
+import org.apache.solr.managed.ManagedComponentId;
+import org.apache.solr.managed.ManagedContext;
 import org.apache.solr.metrics.MetricsMap;
 import org.apache.solr.metrics.SolrMetricsContext;
 import org.slf4j.Logger;
@@ -103,7 +105,7 @@ public class CaffeineCache<K, V> extends SolrCacheBase implements
SolrCache<K, V
     super.init(args, regenerator);
     String str = (String) args.get(SIZE_PARAM);
     maxSize = (str == null) ? 1024 : Integer.parseInt(str);
-    str = (String) args.get("initialSize");
+    str = (String) args.get(INITIAL_SIZE_PARAM);
     initialSize = Math.min((str == null) ? 1024 : Integer.parseInt(str), maxSize);
     str = (String) args.get(MAX_IDLE_TIME_PARAM);
     if (str == null) {
@@ -386,4 +388,14 @@ public class CaffeineCache<K, V> extends SolrCacheBase implements
SolrCache<K, V
     });
     solrMetricsContext.gauge(cacheMap, true, scope, getCategory().toString());
   }
+
+  @Override
+  public ManagedComponentId getManagedComponentId() {
+    return null;
+  }
+
+  @Override
+  public ManagedContext getManagedContext() {
+    return null;
+  }
 }
diff --git a/solr/core/src/java/org/apache/solr/search/SolrCache.java b/solr/core/src/java/org/apache/solr/search/SolrCache.java
index a714155..3744895 100644
--- a/solr/core/src/java/org/apache/solr/search/SolrCache.java
+++ b/solr/core/src/java/org/apache/solr/search/SolrCache.java
@@ -16,9 +16,9 @@
  */
 package org.apache.solr.search;
 
+import org.apache.lucene.util.Accountable;
 import org.apache.solr.core.SolrInfoBean;
 import org.apache.solr.managed.ManagedComponent;
-import org.apache.solr.managed.types.ManagedCacheComponent;
 
 import java.util.Map;
 import java.util.function.Function;
@@ -27,21 +27,33 @@ import java.util.function.Function;
 /**
  * Primary API for dealing with Solr's internal caches.
  */
-public interface SolrCache<K,V> extends SolrInfoBean, ManagedCacheComponent {
+public interface SolrCache<K,V> extends SolrInfoBean, ManagedComponent, Accountable
{
 
+  // current cache properties
+  /** Hit ratio. */
   String HIT_RATIO_PARAM = "hitratio";
+  /** Number of hits. */
   String HITS_PARAM = "hits";
+  /** Number of inserts. */
   String INSERTS_PARAM = "inserts";
+  /** Number of eevictions. */
   String EVICTIONS_PARAM = "evictions";
+  /** Number of lookups. */
   String LOOKUPS_PARAM = "lookups";
+  /** Current cache size. */
   String SIZE_PARAM = "size";
+  /** Maximum allowed size. */
   String MAX_SIZE_PARAM = "maxSize";
+  /** Current RAM bytes used. */
   String RAM_BYTES_USED_PARAM = "ramBytesUsed";
+  /** Maximum allowed RAM use in MB. */
   String MAX_RAM_MB_PARAM = "maxRamMB";
+  /** Maximum idle time allowed in seconds. */
   String MAX_IDLE_TIME_PARAM = "maxIdleTime";
+  /** Initial cache size. */
   String INITIAL_SIZE_PARAM = "initialSize";
+  /** Use a background thread for cache evictions and cleanup. */
   String CLEANUP_THREAD_PARAM = "cleanupThread";
-  String SHOW_ITEMS_PARAM = "showItems";
 
   /**
    * The initialization routine. Instance specific arguments are passed in
diff --git a/solr/core/src/java/org/apache/solr/search/SolrCacheHolder.java b/solr/core/src/java/org/apache/solr/search/SolrCacheHolder.java
index 2e0ea9f..88a821d 100644
--- a/solr/core/src/java/org/apache/solr/search/SolrCacheHolder.java
+++ b/solr/core/src/java/org/apache/solr/search/SolrCacheHolder.java
@@ -150,16 +150,6 @@ public class SolrCacheHolder<K, V> implements SolrCache<K,V>
{
   }
 
   @Override
-  public int getSize() {
-    return delegate.getSize();
-  }
-
-  @Override
-  public float getHitRatio() {
-    return delegate.getHitRatio();
-  }
-
-  @Override
   public long ramBytesUsed() {
     return delegate.ramBytesUsed();
   }
diff --git a/solr/core/src/test/org/apache/solr/managed/TestDefaultResourceManagerPool.java
b/solr/core/src/test/org/apache/solr/managed/TestDefaultResourceManagerPool.java
index 566fc52..4f2fbd8 100644
--- a/solr/core/src/test/org/apache/solr/managed/TestDefaultResourceManagerPool.java
+++ b/solr/core/src/test/org/apache/solr/managed/TestDefaultResourceManagerPool.java
@@ -139,12 +139,12 @@ public class TestDefaultResourceManagerPool extends SolrTestCaseJ4 {
       manageStartLatch.countDown();
       log.info("-- managing");
       pool.getCurrentValues();
-      Map<String, Number> totalValues = pool.getTotalValues();
+      Map<String, Object> totalValues = pool.getTotalValues();
       Map<String, Object> poolLimits = pool.getPoolLimits();
       if (poolLimits.containsKey("foo")) {
         // manage
         if (totalValues.containsKey("bar")) {
-          int totalValue = totalValues.get("bar").intValue();
+          int totalValue = ((Number)totalValues.get("bar")).intValue();
           int poolLimit = ((Number)poolLimits.get("foo")).intValue();
           if (totalValue > poolLimit) {
             for (ManagedComponent cmp : pool.getComponents().values()) {
@@ -193,18 +193,18 @@ public class TestDefaultResourceManagerPool extends SolrTestCaseJ4 {
     resourceManager.createPool("test", "mock", Collections.singletonMap("foo", 10), Collections.emptyMap());
     assertNotNull(resourceManager.getPool("test"));
     for (int i = 0; i < 10; i++) {
-      TestComponent component = new TestComponent("test.component." + i);
+      TestComponent component = new TestComponent("test:component:" + i);
       component.setFoo(i);
       resourceManager.registerComponent("test", component);
     }
     ResourceManagerPool pool = resourceManager.getPool("test");
     assertEquals(10, pool.getComponents().size());
     pool.getCurrentValues();
-    Map<String, Number> totalValues = pool.getTotalValues();
+    Map<String, Object> totalValues = pool.getTotalValues();
     assertNotNull(totalValues.get("bar"));
-    assertEquals(55, totalValues.get("bar").intValue());
+    assertEquals(55, ((Number)totalValues.get("bar")).intValue());
     assertNotNull(totalValues.get("baz"));
-    assertEquals(65, totalValues.get("baz").intValue());
+    assertEquals(65, ((Number)totalValues.get("baz")).intValue());
     for (ManagedComponent cmp : pool.getComponents().values()) {
       TestComponent component = (TestComponent)cmp;
       Map<String, Object> limits = pool.getResourceManagerPlugin().getResourceLimits(component);
@@ -225,9 +225,9 @@ public class TestDefaultResourceManagerPool extends SolrTestCaseJ4 {
     pool.getCurrentValues();
     totalValues = pool.getTotalValues();
     assertNotNull(totalValues.get("bar"));
-    assertEquals(46, totalValues.get("bar").intValue());
+    assertEquals(46, ((Number)totalValues.get("bar")).intValue());
     assertNotNull(totalValues.get("baz"));
-    assertEquals(56, totalValues.get("baz").intValue());
+    assertEquals(56, ((Number)totalValues.get("baz")).intValue());
     int changed = 0;
     for (ManagedComponent cmp : pool.getComponents().values()) {
       TestComponent component = (TestComponent)cmp;


Mime
View raw message