Search in sources :

Example 1 with Subscriber

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();
    }
}
Also used : ConfigKey(com.yahoo.vespa.config.ConfigKey) Subscriber(com.yahoo.container.di.config.Subscriber) QrConfig(com.yahoo.container.QrConfig)

Aggregations

QrConfig (com.yahoo.container.QrConfig)1 Subscriber (com.yahoo.container.di.config.Subscriber)1 ConfigKey (com.yahoo.vespa.config.ConfigKey)1