Hadoop源码分析之产生InputSplit文件过程
static {
try {
META_SPLIT_FILE_HEADER = "META-SPL".getBytes("UTF-8");
} catch (UnsupportedEncodingException u) {
throw new RuntimeException(u);
}
}
public static final TaskSplitMetaInfo EMPTY_TASK_SPLIT = new TaskSplitMetaInfo();

.png)
private long startOffset:该InputSplit在job.split文件中的偏移量
private long inputDataLength:该 InputSplit 的长度
private String[] locations:该 InputSplit 所在的host 列表
.png)
public void readFields(DataInput in) throws IOException {
int len = WritableUtils.readVInt(in);
locations = new String[len];
for (int i = 0; i < locations.length; i++) {
locations[i] = Text.readString(in);
}
startOffset = WritableUtils.readVLong(in);
inputDataLength = WritableUtils.readVLong(in);
}
public void write(DataOutput out) throws IOException {
WritableUtils.writeVInt(out, locations.length);
for (int i = 0; i < locations.length; i++) {
Text.writeString(out, locations[i]);
}
WritableUtils.writeVLong(out, startOffset);
WritableUtils.writeVLong(out, inputDataLength);
}
public interface Writable {
/**
* Serialize the fields of this object to <code>out</code>.
*
* @param out <code>DataOuput</code> to serialize this object into.
* @throws IOException
*/
void write(DataOutput out) throws IOException;
/**
* Deserialize the fields of this object from <code>in</code>.
*
* <p>For efficiency, implementations should attempt to re-use storage in the
* existing object where possible.</p>
*
* @param in <code>DataInput</code> to deseriablize this object from.
* @throws IOException
*/
void readFields(DataInput in) throws IOException;

private TaskSplitIndex splitIndex:Split元信息在 jib.split 文件中的位置
private long inputDataLength:InputSplit的数据长度
private String[] locations:InputSplit所在的host列表
private String splitLocation:job.split文件的位置
private long startOffset:InputSplit在 job.split 文件中的位置
public void readFields(DataInput in) throws IOException {
splitLocation = Text.readString(in);
startOffset = WritableUtils.readVLong(in);
}
public void write(DataOutput out) throws IOException {
Text.writeString(out, splitLocation);
WritableUtils.writeVLong(out, startOffset);
}
Hadoop源码分析之产生InputSplit文件过程的更多相关文章
- hadoop源码分析(2):Map-Reduce的过程解析
一.客户端 Map-Reduce的过程首先是由客户端提交一个任务开始的. 提交任务主要是通过JobClient.runJob(JobConf)静态函数实现的: public static Runnin ...
- Hadoop源码分析(1):HDFS读写过程解析
一.文件的打开 1.1.客户端 HDFS打开一个文件,需要在客户端调用DistributedFileSystem.open(Path f, int bufferSize),其实现为: public F ...
- Hadoop源码分析之数据节点的握手,注册,上报数据块和心跳
转自:http://www.it165.net/admin/html/201402/2382.html 在上一篇文章Hadoop源码分析之DataNode的启动与停止中分析了DataNode节点的启动 ...
- angular源码分析:injector.js文件分析——angular中的依赖注入式如何实现的(续)
昨天晚上写完angular源码分析:angular中jqLite的实现--你可以丢掉jQuery了,给今天定了一个题angular源码分析:injector.js文件,以及angular的加载流程,但 ...
- SpringBoot源码分析之SpringBoot的启动过程
SpringBoot源码分析之SpringBoot的启动过程 发表于 2017-04-30 | 分类于 springboot | 0 Comments | 阅读次数 SpringB ...
- Envoy 源码分析--程序启动过程
目录 Envoy 源码分析--程序启动过程 初始化 main 入口 MainCommon 初始化 服务 InstanceImpl 初始化 启动 main 启动入口 服务启动流程 LDS 服务启动流程 ...
- Spring源码分析专题 —— IOC容器启动过程(上篇)
声明 1.建议先阅读<Spring源码分析专题 -- 阅读指引> 2.强烈建议阅读过程中要参照调用过程图,每篇都有其对应的调用过程图 3.写文不易,转载请标明出处 前言 关于 IOC 容器 ...
- Spring源码分析之Bean的创建过程详解
前文传送门: Spring源码分析之预启动流程 Spring源码分析之BeanFactory体系结构 Spring源码分析之BeanFactoryPostProcessor调用过程详解 本文内容: 在 ...
- Hadoop源码分析之Configuration
转自:http://www.it165.net/admin/html/201312/2178.html org.apache.hadoop.conf.Configuration类是Hadoop所有功能 ...
随机推荐
- vBulletin 5.x 版本通杀远程代码执行漏洞复现
漏洞介绍 vBulletin中存在一个文件包含问题,可使恶意访问者包含来自 vBulletin 服务器的文件并且执行任意 PHP 代码.未经验证的恶意访问者可通过向index.php发出包含 rout ...
- 2016.5.30让窗口处于最顶层的方法,比TopMost灵活
最简单的方法Form. Activate() 稍复杂的方法用API,目前没有看出比第一种方法有什么好处(可操作其它窗口,这就是好处2016.7.31) [System.Runtime.InteropS ...
- HDLM命令dlnkmgr详解之四_monitor/offline/online
1. monitor 以一定的时间间隔监控hba或cha口的IO信息. 命令格式 监控hba口的IO信息: dlnkmgr monitor -hbaid HBA_ID [-intvl Interval ...
- java.lang.OutOfMemoryError: Java heap space异常
最近使用Tomcat跑项目时,其他项目可以正常运行,但有一个项目报java.lang.OutOfMemoryError: Java heap space异常,查了资料后,找到一个处理我所遇见异常的解决 ...
- dubbo-Instantiation of bean failed; nested exception is java.lang.ExceptionInInitializerError
dubbo-2.8.4需用jdk版本为1.8,dubbo-2.5.3可以使用1.7版本的jdk.
- Mybatis的批处理以及执行Update返回行数为负数
项目中用到了批量更新. 在开发当中,可能经常会遇到批量处理这种情况,一般都再在java层面进行, 其本质是节省数据库连接打开关闭的的次数,占用更少的运行内存. 下面先记一下批处理映射吧: mybati ...
- Swing简介
---------------siwuxie095 Swing 简介: Java Swing 是 Java Foundation Classes ...
- 关联映射、关联查询【重点掌握一条SQL语句的那种方法】
1 什么叫关联映射 通过数据库对象之间的关联关系(一对一.一对多.多对多),反映到实体对象上之间的引用. 举例 用户实体类(User):user_id user_name user_token 笔记本 ...
- 高性能MySQL笔记-第5章Indexing for High Performance-005聚集索引
一.聚集索引介绍 1.什么是聚集索引? InnoDB’s clustered indexes actually store a B-Tree index and the rows together i ...
- Android 菜单之子菜单SubMenu
子菜单就是在点击了菜单中的选项后弹出的要对菜单中选项操作的菜单 他的操作与之前的两种类型的菜单操作差不多 动态添加 @Override public boolean onCreat ...