blob: 8b012b15cd37862899cb09da894f97fdfe09ee33 (
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
45
46
47
48
49
50
51
52
53
54
55
|
// Copyright 2020 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.controller.routing;
import com.yahoo.config.provision.ApplicationId;
import com.yahoo.vespa.hosted.controller.application.EndpointId;
import java.util.Objects;
/**
* Unique identifier for a global routing table entry (application x endpoint ID).
*
* @author mpolden
*/
public class RoutingId {
private final ApplicationId application;
private final EndpointId endpointId;
public RoutingId(ApplicationId application, EndpointId endpointId) {
this.application = Objects.requireNonNull(application, "application must be non-null");
this.endpointId = Objects.requireNonNull(endpointId, "endpointId must be non-null");
}
public ApplicationId application() {
return application;
}
public EndpointId endpointId() {
return endpointId;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
RoutingId that = (RoutingId) o;
return application.equals(that.application) &&
endpointId.equals(that.endpointId);
}
@Override
public int hashCode() {
return Objects.hash(application, endpointId);
}
@Override
public String toString() {
return "routing id for " + endpointId + " of " + application;
}
public static RoutingId of(ApplicationId application, EndpointId endpoint) {
return new RoutingId(application, endpoint);
}
}
|