From 199c7256c8bb363a197fb6d99c454921b13165be Mon Sep 17 00:00:00 2001 From: Lee Hinman Date: Thu, 7 Apr 2016 12:54:52 -0600 Subject: [PATCH] Make passed in settings final and use Settings instead of strings --- .../org/elasticsearch/cluster/routing/UnassignedInfo.java | 4 ++-- .../cluster/allocation/ClusterAllocationExplainIT.java | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/core/src/main/java/org/elasticsearch/cluster/routing/UnassignedInfo.java b/core/src/main/java/org/elasticsearch/cluster/routing/UnassignedInfo.java index 96345649935..aea416e9132 100644 --- a/core/src/main/java/org/elasticsearch/cluster/routing/UnassignedInfo.java +++ b/core/src/main/java/org/elasticsearch/cluster/routing/UnassignedInfo.java @@ -236,7 +236,7 @@ public class UnassignedInfo implements ToXContent, Writeable { * * @return calculated delay in nanoseconds */ - public long getRemainingDelay(long nanoTimeNow, Settings settings, Settings indexSettings) { + public long getRemainingDelay(final long nanoTimeNow, final Settings settings, final Settings indexSettings) { final long delayTimeoutNanos = getAllocationDelayTimeoutSettingNanos(settings, indexSettings); if (delayTimeoutNanos == 0L) { return 0L; @@ -251,7 +251,7 @@ public class UnassignedInfo implements ToXContent, Writeable { * * @return updated delay in nanoseconds */ - public long updateDelay(long nanoTimeNow, Settings settings, Settings indexSettings) { + public long updateDelay(final long nanoTimeNow, final Settings settings, final Settings indexSettings) { final long newComputedLeftDelayNanos = getRemainingDelay(nanoTimeNow, settings, indexSettings); lastComputedLeftDelayNanos = newComputedLeftDelayNanos; return newComputedLeftDelayNanos; diff --git a/core/src/test/java/org/elasticsearch/action/admin/cluster/allocation/ClusterAllocationExplainIT.java b/core/src/test/java/org/elasticsearch/action/admin/cluster/allocation/ClusterAllocationExplainIT.java index 693222606df..d2e678ca311 100644 --- a/core/src/test/java/org/elasticsearch/action/admin/cluster/allocation/ClusterAllocationExplainIT.java +++ b/core/src/test/java/org/elasticsearch/action/admin/cluster/allocation/ClusterAllocationExplainIT.java @@ -20,6 +20,8 @@ package org.elasticsearch.action.admin.cluster.allocation; import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsResponse; +import org.elasticsearch.cluster.metadata.IndexMetaData; +import org.elasticsearch.cluster.routing.UnassignedInfo; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ESIntegTestCase; import org.elasticsearch.test.ESSingleNodeTestCase; @@ -51,9 +53,9 @@ public final class ClusterAllocationExplainIT extends ESIntegTestCase { logger.info("--> creating 'test' index"); prepareCreate("test").setSettings(Settings.settingsBuilder() - .put("index.unassigned.node_left.delayed_timeout", "1m") - .put("number_of_shards", 5) - .put("number_of_replicas", 1)).get(); + .put(UnassignedInfo.INDEX_DELAYED_NODE_LEFT_TIMEOUT_SETTING.getKey(), "1m") + .put(IndexMetaData.INDEX_NUMBER_OF_SHARDS_SETTING.getKey(), 5) + .put(IndexMetaData.INDEX_NUMBER_OF_REPLICAS_SETTING.getKey(), 1)).get(); ensureGreen("test"); logger.info("--> stopping a random node");