Package org.apache.hadoop.conf
Class ReconfigurableBase
java.lang.Object
org.apache.hadoop.conf.Configured
org.apache.hadoop.conf.ReconfigurableBase
- All Implemented Interfaces:
Configurable,Reconfigurable
Utility base class for implementing the Reconfigurable interface.
Subclasses should override reconfigurePropertyImpl to change individual
properties and getReconfigurableProperties to get all properties that
can be changed at run time.
-
Constructor Summary
ConstructorsConstructorDescriptionConstruct a ReconfigurableBase.Construct a ReconfigurableBase with theConfigurationconf. -
Method Summary
Modifier and TypeMethodDescriptiongetChangedProperties(Configuration newConf, Configuration oldConf) protected abstract ConfigurationCreate a new configuration.abstract Collection<String>Return all the properties that can be changed at run time.booleanisPropertyReconfigurable(String property) Return whether a given property is changeable at run time.final voidreconfigureProperty(String property, String newVal) Change a configuration property on this object to the value specified.protected abstract StringreconfigurePropertyImpl(String property, String newVal) Change a configuration property.voidvoidvoidStart a reconfiguration task to reload configuration in background.Methods inherited from class org.apache.hadoop.conf.Configured
getConf, setConfMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.hadoop.conf.Configurable
getConf, setConf
-
Constructor Details
-
ReconfigurableBase
public ReconfigurableBase()Construct a ReconfigurableBase. -
ReconfigurableBase
Construct a ReconfigurableBase with theConfigurationconf.- Parameters:
conf- configuration.
-
-
Method Details
-
setReconfigurationUtil
-
getNewConf
Create a new configuration.- Returns:
- configuration.
-
getChangedProperties
@VisibleForTesting public Collection<ReconfigurationUtil.PropertyChange> getChangedProperties(Configuration newConf, Configuration oldConf) -
startReconfigurationTask
Start a reconfiguration task to reload configuration in background.- Throws:
IOException- raised on errors performing I/O.
-
getReconfigurationTaskStatus
-
shutdownReconfigurationTask
public void shutdownReconfigurationTask() -
reconfigureProperty
public final void reconfigureProperty(String property, String newVal) throws ReconfigurationException Change a configuration property on this object to the value specified. Change a configuration property on this object to the value specified and return the previous value that the configuration property was set to (or null if it was not previously set). If newVal is null, set the property to its default value; This method makes the change to this objectsConfigurationand calls reconfigurePropertyImpl to update internal data structures. This method cannot be overridden, subclasses should instead override reconfigurePropertyImpl.- Specified by:
reconfigurePropertyin interfaceReconfigurable- Parameters:
property- property name.newVal- new value.- Throws:
ReconfigurationException- if there was an error applying newVal. If the property cannot be changed, throw aReconfigurationException.
-
getReconfigurableProperties
Return all the properties that can be changed at run time. Subclasses must override this.- Specified by:
getReconfigurablePropertiesin interfaceReconfigurable- Returns:
- reconfigurable propertys.
-
isPropertyReconfigurable
Return whether a given property is changeable at run time. If isPropertyReconfigurable returns true for a property, then changeConf should not throw an exception when changing this property. Subclasses may wish to override this with a more efficient implementation.- Specified by:
isPropertyReconfigurablein interfaceReconfigurable- Parameters:
property- property name.- Returns:
- true if property reconfigurable; false if not.
-
reconfigurePropertyImpl
protected abstract String reconfigurePropertyImpl(String property, String newVal) throws ReconfigurationException Change a configuration property. Subclasses must override this. This method applies the change to all internal data structures derived from the configuration property that is being changed. If this object owns other Reconfigurable objects reconfigureProperty should be called recursively to make sure that the configuration of these objects are updated.- Parameters:
property- Name of the property that is being reconfigured.newVal- Proposed new value of the property.- Returns:
- Effective new value of the property. This may be different from newVal.
- Throws:
ReconfigurationException- if there was an error applying newVal.
-