reset the master ping counter when we get a proper response

This commit is contained in:
kimchy 2010-05-12 15:50:15 +03:00
parent a0b25ec4c3
commit eaa32f28b3
2 changed files with 6 additions and 0 deletions

View File

@ -39,6 +39,8 @@ import static org.elasticsearch.cluster.node.DiscoveryNode.*;
import static org.elasticsearch.util.TimeValue.*; import static org.elasticsearch.util.TimeValue.*;
/** /**
* A fault detection that pings the master periodically to see if its alive.
*
* @author kimchy (shay.banon) * @author kimchy (shay.banon)
*/ */
public class MasterFaultDetection extends AbstractComponent { public class MasterFaultDetection extends AbstractComponent {
@ -191,6 +193,8 @@ public class MasterFaultDetection extends AbstractComponent {
} }
@Override public void handleResponse(MasterPingResponseResponse response) { @Override public void handleResponse(MasterPingResponseResponse response) {
// reset the counter, we got a good result
MasterFaultDetection.this.retryCount = 0;
// check if the master node did not get switched on us... // check if the master node did not get switched on us...
if (sentToNode.equals(MasterFaultDetection.this.masterNode())) { if (sentToNode.equals(MasterFaultDetection.this.masterNode())) {
if (!response.connectedToMaster) { if (!response.connectedToMaster) {

View File

@ -39,6 +39,8 @@ import static org.elasticsearch.util.TimeValue.*;
import static org.elasticsearch.util.concurrent.ConcurrentCollections.*; import static org.elasticsearch.util.concurrent.ConcurrentCollections.*;
/** /**
* A fault detection of multiple nodes.
*
* @author kimchy (shay.banon) * @author kimchy (shay.banon)
*/ */
public class NodesFaultDetection extends AbstractComponent { public class NodesFaultDetection extends AbstractComponent {