Search in sources :

Example 6 with ReconfigurationException

use of org.apache.hadoop.conf.ReconfigurationException in project hadoop by apache.

the class NameNode method reconfHeartbeatInterval.

private String reconfHeartbeatInterval(final DatanodeManager datanodeManager, final String property, final String newVal) throws ReconfigurationException {
    namesystem.writeLock();
    try {
        if (newVal == null) {
            // set to default
            datanodeManager.setHeartbeatInterval(DFS_HEARTBEAT_INTERVAL_DEFAULT);
            return String.valueOf(DFS_HEARTBEAT_INTERVAL_DEFAULT);
        } else {
            datanodeManager.setHeartbeatInterval(Long.parseLong(newVal));
            return String.valueOf(datanodeManager.getHeartbeatInterval());
        }
    } catch (NumberFormatException nfe) {
        throw new ReconfigurationException(property, newVal, getConf().get(property), nfe);
    } finally {
        namesystem.writeUnlock();
        LOG.info("RECONFIGURE* changed heartbeatInterval to " + datanodeManager.getHeartbeatInterval());
    }
}
Also used : ReconfigurationException(org.apache.hadoop.conf.ReconfigurationException)

Example 7 with ReconfigurationException

use of org.apache.hadoop.conf.ReconfigurationException in project hadoop by apache.

the class NameNode method reconfHeartbeatRecheckInterval.

private String reconfHeartbeatRecheckInterval(final DatanodeManager datanodeManager, final String property, final String newVal) throws ReconfigurationException {
    namesystem.writeLock();
    try {
        if (newVal == null) {
            // set to default
            datanodeManager.setHeartbeatRecheckInterval(DFS_NAMENODE_HEARTBEAT_RECHECK_INTERVAL_DEFAULT);
            return String.valueOf(DFS_NAMENODE_HEARTBEAT_RECHECK_INTERVAL_DEFAULT);
        } else {
            datanodeManager.setHeartbeatRecheckInterval(Integer.parseInt(newVal));
            return String.valueOf(datanodeManager.getHeartbeatRecheckInterval());
        }
    } catch (NumberFormatException nfe) {
        throw new ReconfigurationException(property, newVal, getConf().get(property), nfe);
    } finally {
        namesystem.writeUnlock();
        LOG.info("RECONFIGURE* changed heartbeatRecheckInterval to " + datanodeManager.getHeartbeatRecheckInterval());
    }
}
Also used : ReconfigurationException(org.apache.hadoop.conf.ReconfigurationException)

Aggregations

ReconfigurationException (org.apache.hadoop.conf.ReconfigurationException)7 Test (org.junit.Test)4 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)3 Matchers.anyString (org.mockito.Matchers.anyString)3 File (java.io.File)2 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2 Random (java.util.Random)2 BrokenBarrierException (java.util.concurrent.BrokenBarrierException)2 TimeoutException (java.util.concurrent.TimeoutException)2 Path (org.apache.hadoop.fs.Path)2 BlockMissingException (org.apache.hadoop.hdfs.BlockMissingException)2 FsDatasetSpi (org.apache.hadoop.hdfs.server.datanode.fsdataset.FsDatasetSpi)2 InvocationOnMock (org.mockito.invocation.InvocationOnMock)2 List (java.util.List)1 Map (java.util.Map)1 CountDownLatch (java.util.concurrent.CountDownLatch)1 CyclicBarrier (java.util.concurrent.CyclicBarrier)1 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1 MBeanServer (javax.management.MBeanServer)1