Class GenericConfigSubscriber
java.lang.Object
com.yahoo.config.subscription.ConfigSubscriber
com.yahoo.config.subscription.impl.GenericConfigSubscriber
- All Implemented Interfaces:
AutoCloseable
A subscriber that can subscribe without the class. Used by config proxy.
- Author:
- Vegard Havdal
-
Nested Class Summary
Nested classes/interfaces inherited from class com.yahoo.config.subscription.ConfigSubscriber
ConfigSubscriber.SingleSubscriber<T extends com.yahoo.config.ConfigInstance>, ConfigSubscriber.State
-
Field Summary
Fields inherited from class com.yahoo.config.subscription.ConfigSubscriber
subscriptionHandles
-
Constructor Summary
ConstructorDescriptionGenericConfigSubscriber
(JRTConfigRequester requester) Constructs a new subscriber using the given pool of requesters (JRTConfigRequester holds 1 connection which in turn is subject to failover across the elements in the source set.) The behaviour is undefined if the map key is different from the source set the requester was built with. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Do nothing, since we share requesters<T extends com.yahoo.config.ConfigInstance>
ConfigHandle<T>subscribe
(ConfigSubscriber.SingleSubscriber<T> singleSubscriber, Class<T> configClass, String configId) Convenience method that can be used if you only want to subscribe to one config, and want generic error handling.Subscribes to config without using the class.<T extends com.yahoo.config.ConfigInstance>
ConfigHandle<T>Subscribes on the given type ofConfigInstance
with the given config id.<T extends com.yahoo.config.ConfigInstance>
ConfigHandle<T>Subscribes on the given type ofConfigInstance
with the given config id and subscribe timeout.Methods inherited from class com.yahoo.config.subscription.ConfigSubscriber
checkStateBeforeSubscribe, close, finalize, getGeneration, isClosed, nextConfig, nextConfig, nextGeneration, nextGeneration, reload, startConfigThread, state, subscribeAndHandleErrors, throwIfExceptionSet, toString
-
Constructor Details
-
GenericConfigSubscriber
Constructs a new subscriber using the given pool of requesters (JRTConfigRequester holds 1 connection which in turn is subject to failover across the elements in the source set.) The behaviour is undefined if the map key is different from the source set the requester was built with. See alsoJRTConfigRequester(com.yahoo.vespa.config.ConnectionPool, com.yahoo.vespa.config.TimingValues)
- Parameters:
requester
- a config requester
-
-
Method Details
-
subscribe
public GenericConfigHandle subscribe(ConfigKey<RawConfig> key, List<String> defContent, TimingValues timingValues) Subscribes to config without using the class. For internal use in config proxy.- Parameters:
key
- theto subscribe to
defContent
- the config definition content for the config to subscribe totimingValues
-TimingValues
- Returns:
- generic handle
-
subscribe
public <T extends com.yahoo.config.ConfigInstance> ConfigHandle<T> subscribe(Class<T> configClass, String configId) Description copied from class:ConfigSubscriber
Subscribes on the given type ofConfigInstance
with the given config id. The method blocks until the first config is ready to be fetched withConfigSubscriber.nextConfig(boolean)
.- Overrides:
subscribe
in classConfigSubscriber
- Parameters:
configClass
- The class, typically generated from a def-file using config-class-pluginconfigId
- Identifies the service in vespa-services.xml, or null if you are using a localConfigSource
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(Class<T> configClass, String configId, long timeoutMillis) Description copied from class:ConfigSubscriber
Subscribes on the given type ofConfigInstance
with the given config id and subscribe timeout. The method blocks until the first config is ready to be fetched withConfigSubscriber.nextConfig(boolean)
.- Overrides:
subscribe
in classConfigSubscriber
- Parameters:
configClass
- The class, typically generated from a def-file using config-class-pluginconfigId
- 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, Class<T> configClass, String configId) Description copied from class:ConfigSubscriber
Convenience method that can be used if you only want to subscribe to one config, and want generic error handling. ImplementConfigSubscriber.SingleSubscriber
and pass it 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 youConfigSubscriber.close()
thisConfigSubscriber
.- Overrides:
subscribe
in classConfigSubscriber
- Type Parameters:
T
- ConfigInstance type- Parameters:
singleSubscriber
- The object to receive configconfigClass
- The class, typically generated from a def-file using config-class-pluginconfigId
- Identifies the service in vespa-services.xml- Returns:
- The handle of the config
- See Also:
-
closeRequesters
public void closeRequesters()Do nothing, since we share requesters
-