From 759d94833554494887fa74fa9c1e9b41c19de7e3 Mon Sep 17 00:00:00 2001 From: Shay Banon Date: Thu, 5 Jan 2012 20:49:42 +0200 Subject: [PATCH] when setting timeout on cluster health, automatically set the master node timeout as well if it was not explicitly set --- .../action/admin/cluster/health/ClusterHealthRequest.java | 3 +++ .../action/support/master/MasterNodeOperationRequest.java | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/elasticsearch/action/admin/cluster/health/ClusterHealthRequest.java b/src/main/java/org/elasticsearch/action/admin/cluster/health/ClusterHealthRequest.java index 768ae1f9563..8f445bda60a 100644 --- a/src/main/java/org/elasticsearch/action/admin/cluster/health/ClusterHealthRequest.java +++ b/src/main/java/org/elasticsearch/action/admin/cluster/health/ClusterHealthRequest.java @@ -70,6 +70,9 @@ public class ClusterHealthRequest extends MasterNodeOperationRequest { public ClusterHealthRequest timeout(TimeValue timeout) { this.timeout = timeout; + if (masterNodeTimeout == DEFAULT_MASTER_NODE_TIMEOUT) { + masterNodeTimeout = timeout; + } return this; } diff --git a/src/main/java/org/elasticsearch/action/support/master/MasterNodeOperationRequest.java b/src/main/java/org/elasticsearch/action/support/master/MasterNodeOperationRequest.java index 84509d264b7..9ac53394c55 100644 --- a/src/main/java/org/elasticsearch/action/support/master/MasterNodeOperationRequest.java +++ b/src/main/java/org/elasticsearch/action/support/master/MasterNodeOperationRequest.java @@ -33,7 +33,7 @@ public abstract class MasterNodeOperationRequest implements ActionRequest { public static TimeValue DEFAULT_MASTER_NODE_TIMEOUT = TimeValue.timeValueSeconds(30); - private TimeValue masterNodeTimeout = DEFAULT_MASTER_NODE_TIMEOUT; + protected TimeValue masterNodeTimeout = DEFAULT_MASTER_NODE_TIMEOUT; @Override public boolean listenerThreaded() {