hadoop hdfs BlockPoolSlice du directory regularly
来源:互联网 发布:淘宝基金怎么赎回 编辑:程序博客网 时间:2024/05/22 12:25
Part of the constructor of BlockPoolSlice.
// Use cached value initially if available. Or the following call will // block until the initial du command completes. this.dfsUsage = new DU(bpDir, conf, loadDfsUsed()); this.dfsUsage.start();
The constructor of DU
/** * Keeps track of disk usage. * @param path the path to check disk usage in * @param conf configuration object * @param initialUsed use it until the next refresh. * @throws IOException if we fail to refresh the disk usage */ public DU(File path, Configuration conf, long initialUsed) throws IOException { this(path, conf.getLong(CommonConfigurationKeys.FS_DU_INTERVAL_KEY, CommonConfigurationKeys.FS_DU_INTERVAL_DEFAULT), initialUsed); } /** * Keeps track of disk usage. * @param path the path to check disk usage in * @param interval refresh the disk usage at this interval * @param initialUsed use this value until next refresh * @throws IOException if we fail to refresh the disk usage */ public DU(File path, long interval, long initialUsed) throws IOException { super(0); //we set the Shell interval to 0 so it will always run our command //and use this one to set the thread sleep interval this.refreshInterval = interval; this.dirPath = path.getCanonicalPath(); //populate the used variable if the initial value is not specified. if (initialUsed < 0) { run(); } else { this.used.set(initialUsed); } }
DU.start
/** * Start the disk usage checking thread. */ public void start() { //only start the thread if the interval is sane if(refreshInterval > 0) { refreshUsed = new Thread(new DURefreshThread(), "refreshUsed-"+dirPath); refreshUsed.setDaemon(true); refreshUsed.start(); } }
DURefreshThread
/** * This thread refreshes the "used" variable. * * Future improvements could be to not permanently * run this thread, instead run when getUsed is called. **/ class DURefreshThread implements Runnable { @Override public void run() { while(shouldRun) { try { Thread.sleep(refreshInterval); try { //update the used variable DU.this.run(); } catch (IOException e) { synchronized (DU.this) { //save the latest exception so we can return it in getUsed() duException = e; } LOG.warn("Could not get disk usage information", e); } } catch (InterruptedException e) { } } } }
阅读全文
0 0
- hadoop hdfs BlockPoolSlice du directory regularly
- hdfs du操作
- Output directory hdfs://hadoop:8010/user/root/output already exists
- org.apache.hadoop.fs.FileAlreadyExistsException: Output directory hdfs://127.0.0.1:9000/user/hadoop/
- /root/hadoop/bin/hdfs: line 204: /opt/jdk/bin/java: No such file or directory /root/hadoop/bin/hdfs:
- [问题记录]hadoop/hdfs/name is in an inconsistent state: storage directory(hadoop/hdfs/data/) does not ex
- Hadoop HDFS
- hadoop hdfs
- hadoop hdfs
- hadoop hdfs
- Hadoop-HDFS
- Hadoop HDFS
- Hadoop - HDFS
- hadoop HDFS
- Hadoop-hdfs
- hadoop---hdfs
- Hadoop-HDFS
- Hadoop-HDFS
- iOSOpenDev环境搭建
- hdu 1874 畅通工程续 (Dijkstra + 优先队列优化)
- 如何根据 行政边界下载地图
- 面试记录第十七节——(内存管理机制概述)
- 被“现实”打败的3D打印
- hadoop hdfs BlockPoolSlice du directory regularly
- 高级架构师实战:如何用最小的代价完成爬虫需求
- Django中示例验证码的实现总结
- 文章标题
- 纯css制作三级下拉菜单
- SQL 转义字符 单引号
- Linux内核同步机制之三------Seqlock
- Https自签名证书、免费证书SpringBoot、Nginx服务器搭建
- UnityShader初级篇——最简单的顶点/片元着色器