【甘道夫】HBase连接池 -- HTablePool是Deprecated之后
欢迎转载。请注明来源:
HBaseConfiguration conf = HBaseConfiguration.create();
HTable table1 = new HTable(conf, "myTable");
HTable table2 = new HTable(conf, "myTable");
HBaseConfiguration conf1 = HBaseConfiguration.create();
HTable table1 = new HTable(conf1, "myTable");
HBaseConfiguration conf2 = HBaseConfiguration.create();
HTable table2 = new HTable(conf2, "myTable");
Example 9.1. Pre-Creating a HConnection
// Create a connection to the cluster.
HConnection connection = HConnectionManager.createConnection(Configuration);
HTableInterface table = connection.getTable("myTable");
// use table as needed, the table returned is lightweight
table.close();
// use the connection for other access to the cluster
connection.close();
3.HConnectionManager
通过这个HConnection实例,能够使用HConnection.getTable(byte[])方法取得HTableInterface
implementations的实现,比如:
}
调用方负责运行Closeable.close()来关闭获得的连接实例。
connection = HConnectionManager.createConnection(conf);
table = connection.getTable("mytable");
假设没有相应的连接实例存在,该方法创建一个新的连接。
!
4.阅读源代码的新发现
}
}
}
--》HConnectionKey实例的hashcode --》 get返回的connection实例
那“池”的意义就不大了。
Example 9.1. Pre-Creating a HConnection
// Create a connection to the cluster.
HConnection connection = HConnectionManager.createConnection(Configuration);
HTableInterface table = connection.getTable("myTable");
// use table as needed, the table returned is lightweight
table.close();
// use the connection for other access to the cluster
connection.close();
p=hbase.git;a=tree),发现getConnection复活了:
}
p=hbase.git;a=blob;f=pom.xml;h=6b7b65e0821e9d53a1ca7e958aacf9357b741407;hb=HEAD#l41" class="linenr" style="color:rgb(153,153,153); text-decoration:none">41
<packaging>pom</packaging>p=hbase.git;a=blob;f=pom.xml;h=6b7b65e0821e9d53a1ca7e958aacf9357b741407;hb=HEAD#l48" class="linenr" style="color:rgb(153,153,153); text-decoration:none">48
of commodity hardware.p=hbase.git;a=blob;f=CHANGES.txt;h=52d21202fe9c9020a7eeee5d722af3ddf524f092;hb=HEAD" style="color:rgb(0,0,0); text-decoration:none; font-family:monospace; font-size:12px; line-height:normal; background-color:rgb(237,236,230)">CHANGES.txt
文档中没法得到最新的信息。最后一次更新还在2012年2月24日,看来开源大佬们也是爱编码不爱写文档的主。。
版权声明:本文博主原创文章,博客,未经同意不得转载。
【甘道夫】HBase连接池 -- HTablePool是Deprecated之后的更多相关文章
- Hbase的连接池--HTablePool被Deprecated之后
说明: 最近两天在调研HBase的连接池,有了一些收获,特此记录下来. 本文先将官方文档(http://hbase.apache.org/book.html)9.3.1.1节翻译,方便大家阅读,然 ...
- 【甘道夫】Win7x64环境下编译Apache Hadoop2.2.0的Eclipse小工具
目标: 编译Apache Hadoop2.2.0在win7x64环境下的Eclipse插件 环境: win7x64家庭普通版 eclipse-jee-kepler-SR1-win32-x86_64.z ...
- 【甘道夫】MapReduce实现矩阵乘法--实现代码
之前写了一篇分析MapReduce实现矩阵乘法算法的文章: [甘道夫]Mapreduce实现矩阵乘法的算法思路 为了让大家更直观的了解程序运行,今天编写了实现代码供大家參考. 编程环境: java v ...
- 【甘道夫】HBase(0.96以上版本号)过滤器Filter具体解释及实例代码
说明: 本文參考官方Ref Guide,Developer API和众多博客.并结合实測代码编写.具体总结HBase的Filter功能,并附上每类Filter的对应代码实现. 本文尽量遵从Ref Gu ...
- 【甘道夫】HBase基本数据操作的详细说明【完整版,精绝】
介绍 之前具体写了一篇HBase过滤器的文章.今天把基础的表和数据相关操作补上. 本文档參考最新(截止2014年7月16日)的官方Ref Guide.Developer API编写. 全部代码均基于& ...
- 【甘道夫】HBase开发环境搭建过程中可能遇到的异常:No FileSystem for scheme: hdfs
异常: 2014-02-24 12:15:48,507 WARN [Thread-2] util.DynamicClassLoader (DynamicClassLoader.java:<in ...
- 【甘道夫】HBase基本数据操作详解【完整版,绝对精品】
引言 之前详细写了一篇HBase过滤器的文章,今天把基础的表和数据相关操作补上. 本文档参考最新(截止2014年7月16日)的官方Ref Guide.Developer API编写. 所有代码均基于“ ...
- 【甘道夫】Eclipse+Maven搭建HBase开发环境及HBaseDAO代码演示样例
环境: Win764bit Eclipse Version: Kepler Service Release 1 java version "1.7.0_40" 第一步:Eclips ...
- 【甘道夫】Win7环境下Eclipse连接Hadoop2.2.0
准备: 确保hadoop2.2.0集群正常执行 1.eclipse中建立javaproject,导入hadoop2.2.0相关jar包 2.在src根文件夹下拷入log4j.properties,通过 ...
随机推荐
- cocos2d-x 2.2.3 创建项目的方法
直接复制粘贴到txt文本,然后修改后缀为.bat,然后将bat文件放到tools\project-creator的目录下即可. :project_input @echo 请输入项目名称,按回车,例:H ...
- centos下ant的安装
1.创建一个文件夹,用于安装ant.我们这里临时在/usr文件夹下创建ant文件夹. 2.下载 cd /usr/ant进入该文件夹,使用wget ant的下载地址 下载ant到当前文件夹下.附an ...
- Android 上实现非root的 Traceroute -- 非Root权限下移植可运行二进制文件 脚本文件
作者 : 万境绝尘 转载请著名出处 : http://blog.csdn.net/shulianghan/article/details/36438365 演示样例代码下载 : -- CSDN : h ...
- 手势(Gesture)的增加和识别
Android除了提供手势检测之外,还允许把用户手势添加到指定文件中,以备以后使用,当用户再次画出该手势时,系统可识别该手势.Android使用GestureLibrary代表手势库,提供Gestur ...
- OGG-01008 Extract displays Discarding bad record (discard recs=1) when using filter or where clause
因为在extract參数文件里使用了where语句,而where后面的的条件列又不是主键,没有为update.delete操作记录日志,因此会报1008错误. Applies to: Oracle G ...
- “AIR SDK 0.0: AIR SDK location “...\devsdks\AIRSDK\Win” does not exist.”问题解决~
原文同步至:http://www.waylau.com/air-sdk-0-0-air-sdk-location-does-not-exist-address/ 导入AS3项目时提示“AIR SDK ...
- POJ 2250 Compromise (UVA 531)
LCS问题.基金会DP. 我很伤心WA非常多.就在LCS问题,需要记录什么路. 反正自己的纪录path错误,最后,就容易上当. 没有优化,二维阵列,递归打印,cin.eof() 来识别 end of ...
- bat脚本命令
注:本文转载地址 http://www.cnblogs.com/yefengmeander/archive/2011/12/01/2887978.html 1.Echo 命令 打开回显或关闭请求回显 ...
- Linux 0.12 内核管理存储器
Linux 0.12 内核管理存储器 其分段,用分段的机制把进程间的虚拟地址分隔开. 每一个进程都有一张段表LDT.整个系统有一张GDT表.且整个系统仅仅有一个总页表. 其地址翻译过程为: 程序中给出 ...
- java基础程序题
发现自己初学java时保存在word里的练习题,哈哈,放博客里面来作为纪念吧~~~ [程序1] 题目:古典问题:有一对兔子,从出生后第3个月起每个月都生一对兔子,小兔子长到第四个月后每个月又生一对兔 ...