|
@@ -17,12 +17,15 @@
|
|
*/
|
|
*/
|
|
package org.apache.hadoop.hdfs.server.federation.router;
|
|
package org.apache.hadoop.hdfs.server.federation.router;
|
|
|
|
|
|
|
|
+import org.apache.hadoop.thirdparty.com.google.common.annotations.VisibleForTesting;
|
|
|
|
+
|
|
import static org.apache.hadoop.util.ExitUtil.terminate;
|
|
import static org.apache.hadoop.util.ExitUtil.terminate;
|
|
|
|
|
|
import org.apache.hadoop.conf.Configuration;
|
|
import org.apache.hadoop.conf.Configuration;
|
|
import org.apache.hadoop.hdfs.DFSUtil;
|
|
import org.apache.hadoop.hdfs.DFSUtil;
|
|
import org.apache.hadoop.hdfs.HdfsConfiguration;
|
|
import org.apache.hadoop.hdfs.HdfsConfiguration;
|
|
import org.apache.hadoop.service.CompositeService.CompositeServiceShutdownHook;
|
|
import org.apache.hadoop.service.CompositeService.CompositeServiceShutdownHook;
|
|
|
|
+import org.apache.hadoop.tools.fedbalance.FedBalance;
|
|
import org.apache.hadoop.util.ShutdownHookManager;
|
|
import org.apache.hadoop.util.ShutdownHookManager;
|
|
import org.apache.hadoop.util.StringUtils;
|
|
import org.apache.hadoop.util.StringUtils;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
@@ -65,7 +68,7 @@ public final class DFSRouter {
|
|
ShutdownHookManager.get().addShutdownHook(
|
|
ShutdownHookManager.get().addShutdownHook(
|
|
new CompositeServiceShutdownHook(router), SHUTDOWN_HOOK_PRIORITY);
|
|
new CompositeServiceShutdownHook(router), SHUTDOWN_HOOK_PRIORITY);
|
|
|
|
|
|
- Configuration conf = new HdfsConfiguration();
|
|
|
|
|
|
+ Configuration conf = getConfiguration();
|
|
router.init(conf);
|
|
router.init(conf);
|
|
router.start();
|
|
router.start();
|
|
} catch (Throwable e) {
|
|
} catch (Throwable e) {
|
|
@@ -73,4 +76,13 @@ public final class DFSRouter {
|
|
terminate(1, e);
|
|
terminate(1, e);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @VisibleForTesting
|
|
|
|
+ static Configuration getConfiguration() {
|
|
|
|
+ Configuration conf = new HdfsConfiguration();
|
|
|
|
+ conf.addResource(FedBalance.FED_BALANCE_DEFAULT_XML);
|
|
|
|
+ conf.addResource(FedBalance.FED_BALANCE_SITE_XML);
|
|
|
|
+ return conf;
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|