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());
}
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();
}
}
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();
}
Aggregations