aboutsummaryrefslogtreecommitdiffstats
path: root/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/ClusterEvent.java
blob: f7b5b5ee5232d29c8535247c2bad51c0f58cf516 (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
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.clustercontroller.core;

public class ClusterEvent implements Event{

    enum Type {
        SYSTEMSTATE,
        MASTER_ELECTION
    }

    private final String description;
    private long timeMs = 0;
    private final Type type;

    public ClusterEvent(Type type, String description, long timeMs) {
        this.type = type;
        this.description = description;
        this.timeMs = timeMs;
    }

    @Override
    public long getTimeMs() {
        return timeMs;
    }

    @Override
    public String getDescription() {
        return description;
    }

    @Override
    public String toString() {
        return "Cluster event type " + type + " @" + timeMs + ": " + description;
    }

    @Override
    public String getCategory() {
        return type.toString();
    }

}