lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject [lucene-solr] 21/36: Minor edits.
Date Wed, 18 Dec 2019 16:38:59 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 4890c43040229b739e893101a3708033a24255d4
Author: Andrzej Bialecki <ab@apache.org>
AuthorDate: Tue Jul 30 20:49:50 2019 +0200

    Minor edits.
---
 .../solr/managed/DefaultResourceManagerPool.java   |  4 +--
 .../solr/managed/plugins/CacheManagerPlugin.java   |  8 ++---
 .../managed/TestDefaultResourceManagerPool.java    | 36 ++++++++++++++++++++++
 3 files changed, 42 insertions(+), 6 deletions(-)

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 efe892d..9f87f42 100644
--- a/solr/core/src/java/org/apache/solr/managed/DefaultResourceManagerPool.java
+++ b/solr/core/src/java/org/apache/solr/managed/DefaultResourceManagerPool.java
@@ -108,7 +108,7 @@ public class DefaultResourceManagerPool implements ResourceManagerPool
{
   public Map<String, Map<String, Object>> getCurrentValues() throws InterruptedException
{
     updateLock.lockInterruptibly();
     try {
-      // collect current values
+      // collect the current values
       Map<String, Map<String, Object>> currentValues = new HashMap<>();
       for (ManagedComponent managedComponent : resources.values()) {
         try {
@@ -117,7 +117,7 @@ public class DefaultResourceManagerPool implements ResourceManagerPool
{
           log.warn("Error getting managed values from " + managedComponent.getManagedComponentId(),
e);
         }
       }
-      // calculate totals
+      // calculate the totals
       Map<String, Float> newTotalValues = new HashMap<>();
       currentValues.values().forEach(map -> map.forEach((k, v) -> {
         // only calculate totals for numbers
diff --git a/solr/core/src/java/org/apache/solr/managed/plugins/CacheManagerPlugin.java b/solr/core/src/java/org/apache/solr/managed/plugins/CacheManagerPlugin.java
index 67a5bf3..ad1ef3e 100644
--- a/solr/core/src/java/org/apache/solr/managed/plugins/CacheManagerPlugin.java
+++ b/solr/core/src/java/org/apache/solr/managed/plugins/CacheManagerPlugin.java
@@ -45,25 +45,25 @@ public class CacheManagerPlugin extends AbstractResourceManagerPlugin
{
   public static final String DEAD_BAND = "deadBand";
   public static final float DEFAULT_DEAD_BAND = 0.1f;
 
-  private static final Map<String, String> controlledToMonitored = new HashMap<>();
+  protected static final Map<String, String> controlledToMonitored = new HashMap<>();
 
   static {
     controlledToMonitored.put(SolrCache.MAX_RAM_MB_PARAM, SolrCache.RAM_BYTES_USED_PARAM);
     controlledToMonitored.put(SolrCache.MAX_SIZE_PARAM, SolrCache.SIZE_PARAM);
   }
 
-  private static final Collection<String> MONITORED_PARAMS = Arrays.asList(
+  protected static final Collection<String> MONITORED_PARAMS = Arrays.asList(
       SolrCache.SIZE_PARAM,
       SolrCache.HIT_RATIO_PARAM,
       SolrCache.RAM_BYTES_USED_PARAM
   );
 
-  private static final Collection<String> CONTROLLED_PARAMS = Arrays.asList(
+  protected static final Collection<String> CONTROLLED_PARAMS = Arrays.asList(
       SolrCache.MAX_RAM_MB_PARAM,
       SolrCache.MAX_SIZE_PARAM
   );
 
-  private float deadBand = DEFAULT_DEAD_BAND;
+  protected float deadBand = DEFAULT_DEAD_BAND;
 
   @Override
   public Collection<String> getMonitoredParams() {
diff --git a/solr/core/src/test/org/apache/solr/managed/TestDefaultResourceManagerPool.java
b/solr/core/src/test/org/apache/solr/managed/TestDefaultResourceManagerPool.java
new file mode 100644
index 0000000..3b83093
--- /dev/null
+++ b/solr/core/src/test/org/apache/solr/managed/TestDefaultResourceManagerPool.java
@@ -0,0 +1,36 @@
+package org.apache.solr.managed;
+
+import org.apache.solr.SolrTestCaseJ4;
+import org.apache.solr.common.util.IOUtils;
+import org.apache.solr.common.util.TimeSource;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ *
+ */
+public class TestDefaultResourceManagerPool extends SolrTestCaseJ4 {
+
+  private final int SPEED = 50;
+
+  private ResourceManager resourceManager;
+
+  @Before
+  public void initManager() {
+    resourceManager = new DefaultResourceManager(h.getCoreContainer().getResourceLoader(),
TimeSource.get("simTime:" + SPEED));
+  }
+
+  @After
+  public void destroyManager() {
+    if (resourceManager != null) {
+      IOUtils.closeQuietly(resourceManager);
+      resourceManager = null;
+    }
+  }
+
+  @Test
+  public void testBasic() throws Exception {
+
+  }
+}


Mime
View raw message