1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package com.linecorp.centraldogma.client.armeria;
17
18 import static java.util.Objects.requireNonNull;
19
20 import com.linecorp.armeria.client.Endpoint;
21 import com.linecorp.armeria.client.endpoint.EndpointSelectionStrategy;
22 import com.linecorp.armeria.client.endpoint.EndpointSelector;
23 import com.linecorp.centraldogma.client.Watcher;
24
25
26
27
28
29
30
31 public final class CentralDogmaEndpointGroupBuilder<T> {
32
33 private final Watcher<T> watcher;
34 private final EndpointListDecoder<T> endpointListDecoder;
35 private EndpointSelectionStrategy selectionStrategy = EndpointSelectionStrategy.weightedRoundRobin();
36
37 CentralDogmaEndpointGroupBuilder(Watcher<T> watcher, EndpointListDecoder<T> endpointListDecoder) {
38 this.watcher = requireNonNull(watcher, "watcher");
39 this.endpointListDecoder = requireNonNull(endpointListDecoder, "endpointListDecoder");
40 }
41
42
43
44
45 public CentralDogmaEndpointGroupBuilder selectionStrategy(EndpointSelectionStrategy selectionStrategy) {
46 this.selectionStrategy = requireNonNull(selectionStrategy, "selectionStrategy");
47 return this;
48 }
49
50
51
52
53
54 public CentralDogmaEndpointGroup<T> build() {
55 return new CentralDogmaEndpointGroup<>(selectionStrategy, watcher, endpointListDecoder);
56 }
57 }