aboutsummaryrefslogtreecommitdiffstats
path: root/container-core/src/main/java/com/yahoo/container/core/slobrok/SlobrokConfigurator.java
blob: f2cacb1b080eb8752f2c68cacc383778b1d5922f (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
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.container.core.slobrok;

import com.yahoo.cloud.config.SlobroksConfig;
import com.yahoo.cloud.config.SlobroksConfig.Slobrok;
import com.yahoo.container.Container;

import java.util.List;
import java.util.stream.Collectors;

/**
 * Configures which slobrok nodes the container should register with.
 * @author tonytv
 */
public class SlobrokConfigurator {
    public SlobrokConfigurator(SlobroksConfig config) {
        Container.get().getRpcAdaptor().registerInSlobrok(
                connectionSpecs(config.slobrok()));
    }

    private static List<String> connectionSpecs(List<Slobrok> slobroks) {
        return slobroks.stream().
                map(Slobrok::connectionspec).
                collect(Collectors.toList());
    }
}