use of com.yahoo.container.di.config.Subscriber 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();
}
}
Aggregations