Class GenericConfigSubscriber
- java.lang.Object
-
- com.yahoo.config.subscription.ConfigSubscriber
-
- com.yahoo.config.subscription.impl.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
-
-
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
requesters, subscriptionHandles
-
-
Constructor Summary
Constructors Constructor Description GenericConfigSubscriber(java.util.Map<ConfigSourceSet,JRTConfigRequester> requesters)
Constructs a new subscriber using the given pool of requesters (JRTConfigRequester holds 1 connection which in turn is subject to failover across the elems 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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
closeRequesters()
Do nothing, since we share requesters<T extends com.yahoo.config.ConfigInstance>
ConfigHandle<T>subscribe(ConfigSubscriber.SingleSubscriber<T> singleSubscriber, java.lang.Class<T> configClass, java.lang.String configId)
Use this convenience method if you only want to subscribe on one config, and want generic error handling.GenericConfigHandle
subscribe(ConfigKey<RawConfig> key, java.util.List<java.lang.String> defContent, ConfigSource source, TimingValues timingValues)
Subscribes to config without using the class.<T extends com.yahoo.config.ConfigInstance>
ConfigHandle<T>subscribe(java.lang.Class<T> configClass, java.lang.String configId)
Subscribes on the given type ofConfigInstance
with the given config id.<T extends com.yahoo.config.ConfigInstance>
ConfigHandle<T>subscribe(java.lang.Class<T> configClass, java.lang.String configId, long timeoutMillis)
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, getSource, isClosed, isInternalRedeploy, nextConfig, nextConfig, nextGeneration, nextGeneration, reload, requesters, startConfigThread, state, subscribeAndHandleErrors, throwIfExceptionSet, toString
-
-
-
-
Constructor Detail
-
GenericConfigSubscriber
public GenericConfigSubscriber(java.util.Map<ConfigSourceSet,JRTConfigRequester> requesters)
Constructs a new subscriber using the given pool of requesters (JRTConfigRequester holds 1 connection which in turn is subject to failover across the elems 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:
requesters
- a map from config source set to config requester
-
-
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
- theto subscribe to
defContent
- the config definition content for the config to subscribe tosource
- the config source to usetimingValues
-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 ofConfigInstance
with the given config id. The method blocks until the first config is ready to be fetched withConfigSubscriber.nextConfig()
.- 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(java.lang.Class<T> configClass, java.lang.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()
.- 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, 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. ImplementConfigSubscriber.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 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:
ConfigSubscriber.startConfigThread(Runnable)
-
closeRequesters
public void closeRequesters()
Do nothing, since we share requesters- Overrides:
closeRequesters
in classConfigSubscriber
-
-