Search in sources :

Example 16 with ServiceInfo

use of com.yahoo.config.model.api.ServiceInfo in project vespa by vespa-engine.

the class SlobrokMonitor method getSlobrokSpecs.

List<String> getSlobrokSpecs(ApplicationInfo applicationInfo) {
    List<String> slobrokSpecs = new ArrayList<>();
    for (HostInfo host : applicationInfo.getModel().getHosts()) {
        for (ServiceInfo service : host.getServices()) {
            if (!Objects.equals(service.getServiceType(), SLOBROK_SERVICE_TYPE)) {
                continue;
            }
            for (PortInfo port : service.getPorts()) {
                if (port.getTags().contains(SLOBROK_RPC_PORT_TAG)) {
                    Spec spec = new Spec(host.getHostname(), port.getPort());
                    slobrokSpecs.add(spec.toString());
                }
            }
        }
    }
    return slobrokSpecs;
}
Also used : ServiceInfo(com.yahoo.config.model.api.ServiceInfo) PortInfo(com.yahoo.config.model.api.PortInfo) ArrayList(java.util.ArrayList) Spec(com.yahoo.jrt.Spec) HostInfo(com.yahoo.config.model.api.HostInfo)

Aggregations

ServiceInfo (com.yahoo.config.model.api.ServiceInfo)16 HostInfo (com.yahoo.config.model.api.HostInfo)9 Test (org.junit.Test)7 HashMap (java.util.HashMap)5 PortInfo (com.yahoo.config.model.api.PortInfo)4 ApplicationInfo (com.yahoo.config.model.api.ApplicationInfo)3 SuperModelProvider (com.yahoo.config.model.api.SuperModelProvider)3 ApplicationId (com.yahoo.config.provision.ApplicationId)3 HashSet (java.util.HashSet)3 List (java.util.List)3 Map (java.util.Map)3 Model (com.yahoo.config.model.api.Model)2 SuperModel (com.yahoo.config.model.api.SuperModel)2 Zone (com.yahoo.config.provision.Zone)2 MockRestartAction (com.yahoo.vespa.config.server.configchange.MockRestartAction)2 ArrayList (java.util.ArrayList)2 Collections (java.util.Collections)2 Set (java.util.Set)2 Collectors (java.util.stream.Collectors)2 Assert.assertTrue (org.junit.Assert.assertTrue)2