Class GenericConfigSubscriber

  • All Implemented Interfaces:
    java.lang.AutoCloseable

    public class GenericConfigSubscriber
    extends ConfigSubscriber
    A subscriber that can subscribe without the class. Used by configproxy.
    Author:
    Vegard Havdal
    • Method Detail

      • subscribe

        public GenericConfigHandle subscribe​(ConfigKey<RawConfig> key,
                                             java.util.List<java.lang.String> defContent,
                                             ConfigSource source,
                                             TimingValues timingValues)
        Subscribes to config without using the class. For internal use in config proxy.
        Parameters:
        key - the to subscribe to
        defContent - the config definition content for the config to subscribe to
        source - the config source to use
        timingValues - TimingValues
        Returns:
        generic handle
      • subscribe

        public <T extends com.yahoo.config.ConfigInstance> ConfigHandle<T> subscribe​(java.lang.Class<T> configClass,
                                                                                     java.lang.String configId)
        Description copied from class: ConfigSubscriber
        Subscribes on the given type of ConfigInstance with the given config id. The method blocks until the first config is ready to be fetched with ConfigSubscriber.nextConfig().
        Overrides:
        subscribe in class ConfigSubscriber
        Parameters:
        configClass - The class, typically generated from a def-file using config-class-plugin
        configId - Identifies the service in vespa-services.xml, or null if you are using a local ConfigSource which does not use config id. Also supported: raw:, file:, dir: or jar: config id which addresses config locally in the same way.
        Returns:
        a ConfigHandle
      • subscribe

        public <T extends com.yahoo.config.ConfigInstance> ConfigHandle<T> subscribe​(java.lang.Class<T> configClass,
                                                                                     java.lang.String configId,
                                                                                     long timeoutMillis)
        Description copied from class: ConfigSubscriber
        Subscribes on the given type of ConfigInstance with the given config id and subscribe timeout. The method blocks until the first config is ready to be fetched with ConfigSubscriber.nextConfig().
        Overrides:
        subscribe in class ConfigSubscriber
        Parameters:
        configClass - The class, typically generated from a def-file using config-class-plugin
        configId - Identifies the service in vespa-services.xml, or possibly raw:, file:, dir: or jar: type config which addresses config locally.
        timeoutMillis - The time to wait for a config to become available, in milliseconds
        Returns:
        a ConfigHandle
      • subscribe

        public <T extends com.yahoo.config.ConfigInstance> ConfigHandle<T> subscribe​(ConfigSubscriber.SingleSubscriber<T> singleSubscriber,
                                                                                     java.lang.Class<T> configClass,
                                                                                     java.lang.String configId)
        Description copied from class: ConfigSubscriber
        Use this convenience method if you only want to subscribe on one config, and want generic error handling. Implement ConfigSubscriber.SingleSubscriber and pass to this method. You will get initial config, and a config thread will be started. The method will throw in your thread if initial configuration fails, and the config thread will print a generic error message (but continue) if it fails thereafter. The config thread will stop if you ConfigSubscriber.close() this ConfigSubscriber.
        Overrides:
        subscribe in class ConfigSubscriber
        Type Parameters:
        T - ConfigInstance type
        Parameters:
        singleSubscriber - The object to receive config
        configClass - The class, typically generated from a def-file using config-class-plugin
        configId - Identifies the service in vespa-services.xml
        Returns:
        The handle of the config
        See Also:
        ConfigSubscriber.startConfigThread(Runnable)