java writedouble_Java FSDataOutputStream.writeDouble方法代碼示例
import org.apache.hadoop.fs.FSDataOutputStream; //導入方法依賴的package包/類
/**
* Test that the reorder algo works as we expect.
*/
@Test
public void testBlockLocation() throws Exception {
// We need to start HBase to get HConstants.HBASE_DIR set in conf
htu.startMiniZKCluster();
MiniHBaseCluster hbm = htu.startMiniHBaseCluster(1, 1);
conf = hbm.getConfiguration();
// The "/" is mandatory, without it we've got a null pointer exception on the namenode
final String fileName = "/helloWorld";
Path p = new Path(fileName);
final int repCount = 3;
Assert.assertTrue((short) cluster.getDataNodes().size() >= repCount);
// Let's write the file
FSDataOutputStream fop = dfs.create(p, (short) repCount);
final double toWrite = 875.5613;
fop.writeDouble(toWrite);
fop.close();
for (int i=0; i<10; i++){
// The interceptor is not set in this test, so we get the raw list at this point
LocatedBlocks l;
final long max = System.currentTimeMillis() + 10000;
do {
l = getNamenode(dfs.getClient()).getBlockLocations(fileName, 0, 1);
Assert.assertNotNull(l.getLocatedBlocks());
Assert.assertEquals(l.getLocatedBlocks().size(), 1);
Assert.assertTrue("Expecting " + repCount + " , got " + l.get(0).getLocations().length,
System.currentTimeMillis() < max);
} while (l.get(0).getLocations().length != repCount);
// Should be filtered, the name is different => The order won't change
Object originalList[] = l.getLocatedBlocks().toArray();
HFileSystem.ReorderWALBlocks lrb = new HFileSystem.ReorderWALBlocks();
lrb.reorderBlocks(conf, l, fileName);
Assert.assertArrayEquals(originalList, l.getLocatedBlocks().toArray());
// Should be reordered, as we pretend to be a file name with a compliant stuff
Assert.assertNotNull(conf.get(HConstants.HBASE_DIR));
Assert.assertFalse(conf.get(HConstants.HBASE_DIR).isEmpty());
String pseudoLogFile = conf.get(HConstants.HBASE_DIR) + "/" +
HConstants.HREGION_LOGDIR_NAME + "/" + host1 + ",6977,6576" + "/mylogfile";
// Check that it will be possible to extract a ServerName from our construction
Assert.assertNotNull("log= " + pseudoLogFile,
DefaultWALProvider.getServerNameFromWALDirectoryName(dfs.getConf(), pseudoLogFile));
// And check we're doing the right reorder.
lrb.reorderBlocks(conf, l, pseudoLogFile);
Assert.assertEquals(host1, l.get(0).getLocations()[2].getHostName());
// Check again, it should remain the same.
lrb.reorderBlocks(conf, l, pseudoLogFile);
Assert.assertEquals(host1, l.get(0).getLocations()[2].getHostName());
}
}
java writedouble_Java FSDataOutputStream.writeDouble方法代碼示例相关推荐
- java servicefactory_Java DirectoryServiceFactory.getDirectoryService方法代碼示例
本文整理匯總了Java中org.apache.directory.server.core.factory.DirectoryServiceFactory.getDirectoryService方法的典 ...
- java getstringarray_Java AnnotationAttributes.getStringArray方法代碼示例
本文整理匯總了Java中org.springframework.core.annotation.AnnotationAttributes.getStringArray方法的典型用法代碼示例.如果您正苦 ...
- java getselecteditem_Java JComboBox.getSelectedItem方法代碼示例
本文整理匯總了Java中javax.swing.JComboBox.getSelectedItem方法的典型用法代碼示例.如果您正苦於以下問題:Java JComboBox.getSelectedIt ...
- java setlocation_Java Point.setLocation方法代碼示例
本文整理匯總了Java中java.awt.Point.setLocation方法的典型用法代碼示例.如果您正苦於以下問題:Java Point.setLocation方法的具體用法?Java Poin ...
- java setpriority_Java TaskEntity.setPriority方法代碼示例
本文整理匯總了Java中org.activiti.engine.impl.persistence.entity.TaskEntity.setPriority方法的典型用法代碼示例.如果您正苦於以下問題 ...
- java importgeopoint_Java GeoPoint.project方法代碼示例
本文整理匯總了Java中com.nextgis.maplib.datasource.GeoPoint.project方法的典型用法代碼示例.如果您正苦於以下問題:Java GeoPoint.proje ...
- java hssffont_Java HSSFFont.setColor方法代碼示例
本文整理匯總了Java中org.apache.poi.hssf.usermodel.HSSFFont.setColor方法的典型用法代碼示例.如果您正苦於以下問題:Java HSSFFont.setC ...
- java disconnect_Java BlockingConnection.disconnect方法代碼示例
本文整理匯總了Java中org.fusesource.mqtt.client.BlockingConnection.disconnect方法的典型用法代碼示例.如果您正苦於以下問題:Java Bloc ...
- java dofinal_Java Mac.doFinal方法代碼示例
本文整理匯總了Java中javax.crypto.Mac.doFinal方法的典型用法代碼示例.如果您正苦於以下問題:Java Mac.doFinal方法的具體用法?Java Mac.doFinal怎 ...
最新文章
- pb更新oracle表格,PB自定义retrieve刷新函数、PB导入excel表、打印
- 框架:Spring事务的隔离级别
- SpiderData 2019年2月22日 DApp数据排行榜
- Learn Blockchains by Building One
- 多项式快速插值学习小记
- 两条信号之间加电容_上海贴片电阻电容厂家地址-华腾电子
- Markdown列表
- python程序-30分钟学会用Python编写简单程序
- MikroTik RouterOS 3.30 安装+免SSH全自动算号+自动注册L6图文全过程
- 瑞星:愚人节Conficker蠕虫未在我国爆发
- matlab 画光束等相面,拉盖尔高斯光束_厄米高斯光束MATLAB仿真 - 范文中心
- java输出long最大值_Java调用long的最大值和最小值
- 解决zabbix自动发现主机后主机名称是IP地址的问题
- HTML5期末大作业:个人网页设计——作家三毛6页(代码质量好) 学生DW网页设计作业源码 web课程设计网页规划与设计
- View控件获得焦点,TextView获得焦点(focusable),自定义TextView使得其获得焦点,View的onFocusChange()
- 虚拟机vn登陆服务器系统,虚拟机搭建windows服务器
- 正点原子stm32F407学习笔记3——蜂鸣器实验
- VFB组件:ListBox控件(列表框)
- 林大ACM培训day2心得
- GB18030与GBK、GB2312字节对照
热门文章
- 飞鸽推广的由咪商务微博
- 163相册密码破解 - 简单版
- BOOT.INI文件的目的[微软提供]
- C++工程师面试题大全
- 前端进阶必备技能:Vue中如何定制动画效果
- ​面试官口述:我是这样面试web前端开发求职者(有干货)
- Java制作一个盒子程序_编写一个简单的Java程序,模拟计算器的功能。
- mysql 索引 测试_mysql的索引测试
- python装饰器_Python基础-装饰器
- ftpclient读取服务器文件能获得文件名文件大小0_Spring WEB工程整合使用FTP,ftp文本文件解析入库,文件上传下载