com.netflix.config
Class DynamicConfiguration

java.lang.Object
  extended by org.apache.commons.configuration.event.EventSource
      extended by org.apache.commons.configuration.AbstractConfiguration
          extended by com.netflix.config.ConcurrentMapConfiguration
              extended by com.netflix.config.DynamicConfiguration
All Implemented Interfaces:
org.apache.commons.configuration.Configuration
Direct Known Subclasses:
DynamicURLConfiguration

public class DynamicConfiguration
extends ConcurrentMapConfiguration

A configuration that polls a PolledConfigurationSource according to the schedule set by a scheduler. The property values in this configuration will be changed dynamically at runtime if the value changes in the configuration source.

This configuration does not allow null as key or value and will throw NullPointerException when trying to add or set properties with empty key or value.


Field Summary
 
Fields inherited from class com.netflix.config.ConcurrentMapConfiguration
map
 
Fields inherited from class org.apache.commons.configuration.AbstractConfiguration
END_TOKEN, EVENT_ADD_PROPERTY, EVENT_CLEAR, EVENT_CLEAR_PROPERTY, EVENT_READ_PROPERTY, EVENT_SET_PROPERTY, START_TOKEN
 
Constructor Summary
DynamicConfiguration()
           
DynamicConfiguration(PolledConfigurationSource source, AbstractPollingScheduler scheduler)
          Create an instance and start polling the configuration source.
 
Method Summary
 PolledConfigurationSource getSource()
           
protected  void init(PolledConfigurationSource source, AbstractPollingScheduler scheduler)
          Initialize the configuration.
 void startPolling(PolledConfigurationSource source, AbstractPollingScheduler scheduler)
          Start polling the configuration source with the specified scheduler.
 void stopLoading()
          Stops the scheduler
 
Methods inherited from class com.netflix.config.ConcurrentMapConfiguration
addConfigurationListener, addErrorListener, addProperty, addPropertyDirect, addPropertyImpl, clear, clearConfigurationListeners, clearErrorListeners, clearPropertyDirect, containsKey, copy, fireError, fireEvent, getConfigurationListeners, getErrorListeners, getKeys, getProperties, getProperty, isEmpty, loadProperties, removeConfigurationListener, removeErrorListener, setProperty, setPropertyImpl
 
Methods inherited from class org.apache.commons.configuration.AbstractConfiguration
addErrorLogListener, append, clearProperty, createInterpolator, getBigDecimal, getBigDecimal, getBigInteger, getBigInteger, getBoolean, getBoolean, getBoolean, getByte, getByte, getByte, getDefaultListDelimiter, getDelimiter, getDouble, getDouble, getDouble, getFloat, getFloat, getFloat, getInt, getInt, getInteger, getInterpolator, getKeys, getList, getList, getListDelimiter, getLogger, getLong, getLong, getLong, getProperties, getProperties, getShort, getShort, getShort, getString, getString, getStringArray, getSubstitutor, interpolate, interpolate, interpolatedConfiguration, interpolateHelper, isDelimiterParsingDisabled, isScalarValue, isThrowExceptionOnMissing, resolveContainerStore, setDefaultListDelimiter, setDelimiter, setDelimiterParsingDisabled, setListDelimiter, setLogger, setThrowExceptionOnMissing, subset
 
Methods inherited from class org.apache.commons.configuration.event.EventSource
clone, createErrorEvent, createEvent, isDetailEvents, setDetailEvents
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DynamicConfiguration

public DynamicConfiguration(PolledConfigurationSource source,
                            AbstractPollingScheduler scheduler)
Create an instance and start polling the configuration source.

Parameters:
source - PolledConfigurationSource to poll
scheduler - AbstractPollingScheduler whose AbstractPollingScheduler.schedule(Runnable) will be used to determine the polling schedule

DynamicConfiguration

public DynamicConfiguration()
Method Detail

startPolling

public void startPolling(PolledConfigurationSource source,
                         AbstractPollingScheduler scheduler)
Start polling the configuration source with the specified scheduler.

Parameters:
source - PolledConfigurationSource to poll
scheduler - AbstractPollingScheduler whose AbstractPollingScheduler.schedule(Runnable) will be used to determine the polling schedule

init

protected void init(PolledConfigurationSource source,
                    AbstractPollingScheduler scheduler)
Initialize the configuration. This method is called in DynamicConfiguration(PolledConfigurationSource, AbstractPollingScheduler) and startPolling(PolledConfigurationSource, AbstractPollingScheduler) before the initial polling. The default implementation does nothing.


stopLoading

public void stopLoading()
Stops the scheduler


getSource

public PolledConfigurationSource getSource()