Class JRTConfigSubscription<T extends com.yahoo.config.ConfigInstance>
- java.lang.Object
-
- com.yahoo.config.subscription.impl.ConfigSubscription<T>
-
- com.yahoo.config.subscription.impl.JRTConfigSubscription<T>
-
- Direct Known Subclasses:
GenericJRTConfigSubscription
public class JRTConfigSubscription<T extends com.yahoo.config.ConfigInstance> extends ConfigSubscription<T>
A JRT config subscription uses oneJRTConfigRequester
to fetch config using Vespa RPC from a config source, typically proxy or server- Author:
- vegardh
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.yahoo.config.subscription.impl.ConfigSubscription
ConfigSubscription.ConfigState<T extends com.yahoo.config.ConfigInstance>
-
-
Field Summary
-
Fields inherited from class com.yahoo.config.subscription.impl.ConfigSubscription
configClass, key, log, subscriber
-
-
Constructor Summary
Constructors Constructor Description JRTConfigSubscription(ConfigKey<T> key, ConfigSubscriber subscriber, ConfigSource source, TimingValues timingValues)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
boolean
nextConfig(long timeoutMillis)
Polls this subscription for a change.void
reload(long generation)
Force this into the given generation, used in testingJRTConfigRequester
requester()
protected void
setNewConfig(JRTClientConfigRequest jrtReq)
boolean
subscribe(long timeout)
Will block until the nextConfigSubscription.nextConfig(long)
is guaranteed to return an answer (or throw) immediately (i.e.TimingValues
timingValues()
The timing values of this-
Methods inherited from class com.yahoo.config.subscription.impl.ConfigSubscription
checkReloaded, equals, get, getConfigClass, getConfigState, getDefContent, getException, getKey, isConfigChangedAndReset, setConfigIfChanged, setConfigIncGen, setException, toString
-
-
-
-
Constructor Detail
-
JRTConfigSubscription
public JRTConfigSubscription(ConfigKey<T> key, ConfigSubscriber subscriber, ConfigSource source, TimingValues timingValues)
-
-
Method Detail
-
nextConfig
public boolean nextConfig(long timeoutMillis)
Description copied from class:ConfigSubscription
Polls this subscription for a change. The method is guaranteed to use all of the given timeout before returning false. It will also take into account a user-set generation, that can be set byConfigSubscriber.reload(long)
.- Specified by:
nextConfig
in classConfigSubscription<T extends com.yahoo.config.ConfigInstance>
- Parameters:
timeoutMillis
- in milliseconds- Returns:
- false if timed out, true if generation or config or
ConfigSubscription.exception
changed. If true, theConfigSubscription.config
field will be set also. has changed
-
setNewConfig
protected void setNewConfig(JRTClientConfigRequest jrtReq)
-
subscribe
public boolean subscribe(long timeout)
Description copied from class:ConfigSubscription
Will block until the nextConfigSubscription.nextConfig(long)
is guaranteed to return an answer (or throw) immediately (i.e. not block)- Specified by:
subscribe
in classConfigSubscription<T extends com.yahoo.config.ConfigInstance>
- Parameters:
timeout
- in milliseconds- Returns:
- false if timed out
-
close
public void close()
- Overrides:
close
in classConfigSubscription<T extends com.yahoo.config.ConfigInstance>
-
timingValues
public TimingValues timingValues()
The timing values of this- Returns:
- timing values
-
requester
public JRTConfigRequester requester()
-
reload
public void reload(long generation)
Description copied from class:ConfigSubscription
Force this into the given generation, used in testing- Overrides:
reload
in classConfigSubscription<T extends com.yahoo.config.ConfigInstance>
- Parameters:
generation
- a config generation
-
-