aboutsummaryrefslogtreecommitdiffstats
path: root/container-search/src/main/java/com/yahoo/search/cluster/NodeManager.java
blob: c4a532bdb039808ba03c40139ab6418ab15d637f (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
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.cluster;

import java.util.concurrent.Executor;

/**
 * Must be implemented by a node collection which wants
 * it's node state monitored by a ClusterMonitor
 *
 * @author bratseth
 */
public interface NodeManager<T> {

    /** Name to identify Nodemanager */
    default String name() { return ""; }

    /** Called when a failed node is working (ready for production) again */
    void working(T node);

    /** Called when a working node fails */
    void failed(T node);

    /**
     * Called when a node should be pinged.
     * This *must* lead to either a call to ClusterMonitor.failed or ClusterMonitor.responded
     */
    void ping(ClusterMonitor<T> clusterMonitor, T node, Executor executor);

    /** Called right after a ping has been issued to each node. This default implementation does nothing. */
    default void pingIterationCompleted() {}

}