aboutsummaryrefslogtreecommitdiffstats
path: root/container-search/src/main/java/com/yahoo/search/cluster/MonitorConfiguration.java
blob: f8f8c0d888dca581b250867c3c8a6bdf97ac3cfe (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.cluster;

/**
 * The configuration of a cluster monitor instance
 *
 * @author bratseth
 */
public class MonitorConfiguration  {

    /** The interval in ms between consecutive checks of the monitored nodes */
    private final long checkInterval = 1000;

    /** The number of milliseconds to attempt to complete a request before giving up */
    private final long requestTimeout = 980;

    /** The number of milliseconds a node is allowed to fail before we mark it as not working */
    private final long failLimit = 5000;

    /** Returns the interval between each ping of idle or failing nodes. Default is 1000 ms. */
    public long getCheckInterval() { return checkInterval; }

    /**
     * Returns the number of milliseconds to attempt to service a request
     * (at different nodes) before giving up. See {@link #requestTimeout}.
     */
    public long getRequestTimeout() { return requestTimeout; }

    /**
     * Returns the number of milliseconds a node is allowed to fail before we
     * mark it as not working
     */
    public long getFailLimit() { return failLimit; }

    @Override
    public String toString() {
        return "monitor configuration [" +
               "checkInterval: " + checkInterval +
               " requestTimeout " + requestTimeout +
               " failLimit " + failLimit +
               "]";
    }

}