【甘道夫】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,通过 ...
随机推荐
- Linux中块设备驱动程序分析
基于<Linux设备驱动程序>书中的sbull程序以对Linux块设备驱动总结分析. 開始之前先来了解这个块设备中的核心数据结构: struct sbull_dev { i ...
- 黄聪:Microsoft Enterprise Library 5.0 系列教程(九) Policy Injection Application Block
原文:黄聪:Microsoft Enterprise Library 5.0 系列教程(九) Policy Injection Application Block 代理对象(Proxy Object) ...
- 冒泡排序算法 C++和PHP达到
冒泡排序是小元素向前或向后的大要素.两个相邻元件之间的比较结果更.交换也这两个元件之间发生.它是最慢的排序算法. 效率最低的算法. 时间复杂度: 它是最差时间复杂度为:O(n^2),冒泡排序最好的时间 ...
- 前端构建工具gulp
前端构建工具gulp使用 前端自动化流程工具,用来合并文件,压缩等. Gulp官网 http://gulpjs.com/ Gulp中文网 http://www.gulpjs.com.cn/ Gul ...
- J2SE习题(2)
第四.五周练习题 1.a. Define a class called BlogEntry that could be used to store an entry for a Weblog. Th ...
- 重新想象 Windows 8 Store Apps (33) - 关联启动: 使用外部程序打开一个文件或uri, 关联指定的文件类型或协议
原文:重新想象 Windows 8 Store Apps (33) - 关联启动: 使用外部程序打开一个文件或uri, 关联指定的文件类型或协议 [源码下载] 重新想象 Windows 8 Store ...
- Jenkins(转)
1 修改jenkins的根目录,默认地在C:\Documents and Settings\AAA\.jenkins . .jenkins ├─jobs│ └─JavaHelloWorld│ ...
- WPF 绑定
WPF里分三种Binding:Binding, PriorityBinding, MultiBinding,这三种Binding的基类都是BindingBase,而BindingBase又继承于Mar ...
- Mono for Android开发调研笔记
安装完Mono for Android(简称:MonoDroid)之后,可以用MonoDevelop或Visual Studio来开发Mono for Android应用程序:目前只能在模拟器上调试和 ...
- jQuery整理笔记2----jQuery选择整理
一个.基本的选择 1.ID选择器 JavaScript提供了原生方法实如今DOM中选择指定ID值得元素. 使用方法例如以下: var element=document.getElementById(& ...