org.apache.hadoop.conf
Class ReconfigurableBase

java.lang.Object
  extended by org.apache.hadoop.conf.Configured
      extended by org.apache.hadoop.conf.ReconfigurableBase
All Implemented Interfaces:
Configurable, Reconfigurable

public abstract class ReconfigurableBase
extends Configured
implements 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
ReconfigurableBase()
          Construct a ReconfigurableBase.
ReconfigurableBase(Configuration conf)
          Construct a ReconfigurableBase with the Configuration conf.
 
Method Summary
abstract  Collection<String> getReconfigurableProperties()
          Return all the properties that can be changed at run time.
 boolean isPropertyReconfigurable(String property)
          Return whether a given property is changeable at run time.
 String reconfigureProperty(String property, String newVal)
          Change a configuration property on this object to the value specified.
protected abstract  void reconfigurePropertyImpl(String property, String newVal)
          Change a configuration property.
 
Methods inherited from class org.apache.hadoop.conf.Configured
getConf, setConf
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.hadoop.conf.Configurable
getConf, setConf
 

Constructor Detail

ReconfigurableBase

public ReconfigurableBase()
Construct a ReconfigurableBase.


ReconfigurableBase

public ReconfigurableBase(Configuration conf)
Construct a ReconfigurableBase with the Configuration conf.

Method Detail

reconfigureProperty

public final String 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; If the property cannot be changed, throw a ReconfigurationException. This method makes the change to this objects Configuration and calls reconfigurePropertyImpl to update internal data structures. This method cannot be overridden, subclasses should instead override reconfigureProperty.

Specified by:
reconfigureProperty in interface Reconfigurable
Throws:
ReconfigurationException

getReconfigurableProperties

public abstract Collection<String> getReconfigurableProperties()
Return all the properties that can be changed at run time. Subclasses must override this.

Specified by:
getReconfigurableProperties in interface Reconfigurable

isPropertyReconfigurable

public boolean isPropertyReconfigurable(String property)
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:
isPropertyReconfigurable in interface Reconfigurable

reconfigurePropertyImpl

protected abstract void 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 to make sure that the configuration of these objects is updated.

Throws:
ReconfigurationException


Copyright © 2013 Apache Software Foundation. All Rights Reserved.