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 config subscription for a config instance, gets config using RPC from a config source
(config proxy or config 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 -
Constructor Summary
ConstructorsConstructorDescriptionJRTConfigSubscription(ConfigKey<T> key, JRTConfigRequester requester, TimingValues timingValues) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()booleannextConfig(long timeoutMillis) Polls this subscription for a change.voidreload(long generation) Force this into the given generation, used in testingprotected voidsetNewConfig(JRTClientConfigRequest jrtReq) protected voidbooleansubscribe(long timeout) Will block until the nextConfigSubscription.nextConfig(long)is guaranteed to return an answer (or throw) immediately (i.e. not block)The timing values of thisMethods inherited from class com.yahoo.config.subscription.impl.ConfigSubscription
checkReloaded, equals, get, getConfigClass, getConfigState, getDefContent, getException, getKey, isClosed, isConfigChangedAndReset, setConfigIfChanged, setConfigIncGen, setException, toString
-
Constructor Details
-
JRTConfigSubscription
public JRTConfigSubscription(ConfigKey<T> key, JRTConfigRequester requester, TimingValues timingValues)
-
-
Method Details
-
nextConfig
public boolean nextConfig(long timeoutMillis) Description copied from class:ConfigSubscriptionPolls 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:
nextConfigin classConfigSubscription<T extends com.yahoo.config.ConfigInstance>- Parameters:
timeoutMillis- in milliseconds- Returns:
- false if timed out, true if generation or config or
ConfigSubscription.exceptionchanged. If true, theConfigSubscription.configfield will be set also. has changed
-
setNewConfig
-
setNewConfigAndGeneration
-
subscribe
public boolean subscribe(long timeout) Description copied from class:ConfigSubscriptionWill block until the nextConfigSubscription.nextConfig(long)is guaranteed to return an answer (or throw) immediately (i.e. not block)- Specified by:
subscribein classConfigSubscription<T extends com.yahoo.config.ConfigInstance>- Parameters:
timeout- in milliseconds- Returns:
- false if timed out
-
close
public void close()- Overrides:
closein classConfigSubscription<T extends com.yahoo.config.ConfigInstance>
-
timingValues
The timing values of this- Returns:
- timing values
-
requester
-
reload
public void reload(long generation) Description copied from class:ConfigSubscriptionForce this into the given generation, used in testing- Overrides:
reloadin classConfigSubscription<T extends com.yahoo.config.ConfigInstance>- Parameters:
generation- a config generation
-