Make passed in settings final and use Settings instead of strings

This commit is contained in:
Lee Hinman 2016-04-07 12:54:52 -06:00
parent 78e6ff6e5e
commit 199c7256c8
2 changed files with 7 additions and 5 deletions

View File

@ -236,7 +236,7 @@ public class UnassignedInfo implements ToXContent, Writeable<UnassignedInfo> {
*
* @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<UnassignedInfo> {
*
* @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;

View File

@ -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");