Search in sources :

Example 1 with QrConfig

use of com.yahoo.container.QrConfig in project vespa by vespa-engine.

the class ContainerModelBuilderTest method qrconfig_is_produced.

@Test
public void qrconfig_is_produced() throws IOException, SAXException {
    String servicesXml = "<services>" + "<admin version='3.0'>" + "    <nodes count='1'/>" + "</admin>" + "<jdisc id ='default' version='1.0'>" + "  <nodes>" + "    <node hostalias='node1' />" + "  </nodes>" + "</jdisc>" + "</services>";
    ApplicationPackage applicationPackage = new MockApplicationPackage.Builder().withServices(servicesXml).build();
    VespaModel model = new VespaModel(new NullConfigModelRegistry(), new DeployState.Builder().applicationPackage(applicationPackage).properties(new DeployProperties.Builder().build()).build(true));
    // Using the same way of getting hostname as filedistribution model
    String hostname = HostName.getLocalhost();
    QrConfig config = model.getConfig(QrConfig.class, "default/container.0");
    assertEquals("default.container.0", config.discriminator());
    assertEquals(19102, config.rpc().port());
    assertEquals("vespa/service/default/container.0", config.rpc().slobrokId());
    assertEquals(true, config.rpc().enabled());
    assertEquals("", config.rpc().host());
    assertEquals(false, config.restartOnDeploy());
    assertEquals(false, config.coveragereports());
    assertEquals("filedistribution/" + hostname, config.filedistributor().configid());
}
Also used : NullConfigModelRegistry(com.yahoo.config.model.NullConfigModelRegistry) VespaModel(com.yahoo.vespa.model.VespaModel) QrConfig(com.yahoo.container.QrConfig) Matchers.containsString(org.hamcrest.Matchers.containsString) ApplicationPackage(com.yahoo.config.application.api.ApplicationPackage) MockApplicationPackage(com.yahoo.config.model.test.MockApplicationPackage) DomBuilderTest(com.yahoo.config.model.builder.xml.test.DomBuilderTest) Test(org.junit.Test)

Example 2 with QrConfig

use of com.yahoo.container.QrConfig in project vespa by vespa-engine.

the class ConfiguredApplication method watchPortChange.

private void watchPortChange() {
    Subscriber subscriber = subscriberFactory.getSubscriber(Collections.singleton(new ConfigKey<>(QrConfig.class, configId)));
    try {
        while (true) {
            subscriber.waitNextGeneration();
            QrConfig newConfig = QrConfig.class.cast(first(subscriber.config().values()));
            if (qrConfig.rpc().port() != newConfig.rpc().port()) {
                com.yahoo.protect.Process.logAndDie("Rpc port config has changed from " + qrConfig.rpc().port() + " to " + newConfig.rpc().port() + ". This we can not handle without a restart so we will just bail out.");
            }
            log.fine("Received new QrConfig :" + newConfig);
        }
    } finally {
        subscriber.close();
    }
}
Also used : ConfigKey(com.yahoo.vespa.config.ConfigKey) Subscriber(com.yahoo.container.di.config.Subscriber) QrConfig(com.yahoo.container.QrConfig)

Example 3 with QrConfig

use of com.yahoo.container.QrConfig in project vespa by vespa-engine.

the class ConfiguredApplication method start.

@Override
public void start() {
    qrConfig = getConfig(QrConfig.class);
    ContainerDiscApplication.hackToInitializeServer(qrConfig);
    ContainerBuilder builder = createBuilderWithGuiceBindings();
    configureComponents(builder.guiceModules().activate());
    intitializeAndActivateContainer(builder);
    startReconfigurerThread();
    portWatcher = new Thread(this::watchPortChange);
    portWatcher.setDaemon(true);
    portWatcher.start();
}
Also used : ContainerBuilder(com.yahoo.jdisc.application.ContainerBuilder) QrConfig(com.yahoo.container.QrConfig)

Aggregations

QrConfig (com.yahoo.container.QrConfig)3 ApplicationPackage (com.yahoo.config.application.api.ApplicationPackage)1 NullConfigModelRegistry (com.yahoo.config.model.NullConfigModelRegistry)1 DomBuilderTest (com.yahoo.config.model.builder.xml.test.DomBuilderTest)1 MockApplicationPackage (com.yahoo.config.model.test.MockApplicationPackage)1 Subscriber (com.yahoo.container.di.config.Subscriber)1 ContainerBuilder (com.yahoo.jdisc.application.ContainerBuilder)1 ConfigKey (com.yahoo.vespa.config.ConfigKey)1 VespaModel (com.yahoo.vespa.model.VespaModel)1 Matchers.containsString (org.hamcrest.Matchers.containsString)1 Test (org.junit.Test)1