【甘道夫】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,通过 ...
随机推荐
- SQLserver2012 tcp/ip 1433port问题解决方法
非常多MSSQL安装完毕后,调用1433(默认port)是失败的,这边具体介绍下解决方法. 一..我们须要在电脑上开启telnet服务,定位问题须要.在cmd下使用telnet,假设报命令不存在说明没 ...
- Spark1.0.0 属性配置
1:Spark1.0.0属性配置方式 Spark属性提供了大部分应用程序的控制项,而且能够单独为每一个应用程序进行配置. 在Spark1.0.0提供了3种方式的属性配置: Sp ...
- Eclipse SVN 安装注意事项
1. 下载SVN 插件 打开 Eclipse , 菜单条 Help -> Install New Software 在 Work with 这里加入网址 : http://subclipse ...
- atitit.标准时间格式 相互转换 秒数 最佳实践
atitit.标准时间格式 相互转换 秒数 最佳实践 例如00:01:19 转换为秒数 79,,and互相转换 一个思路是使用div 60 mod...只是麻烦的... 更好的方法是使用stamp ...
- 教你使用破解无线路由器笔记本password
近期非常多人问我怎么破解WiFipassword…看来大家都对免费的东西比較有兴趣.要么也可能是我太招摇了…囧… 好吧,我就写篇小小的教程,看完后,你应该可以破解大部分无线路由器password了.写 ...
- Lua语言在Wireshark中使用(转)
1. 检查Wireshark的版本是否支持Lua 打开Wireshark,点击“HelpàAbout Wireshark”菜单,查看弹出的对话框,如果有“with Lua 5.1”表示支持 ...
- lunix shell 基础经常使用整理
1 ps -ef 显示正在执行的进程,pid 等信息 UID PID PPID C STIME TTY TIME CMD root 1 0 0 03:45 ? 00:00:02 ini ...
- HDU 4149 Magic Potion
意甲冠军: a[i] ^ x = f[i] ( i = 1...8 ) 和 ( a[1] + a[2] + ... + a[8] ) ^ x = f[9] 如今f为已知 求x 思路: 从低位到高位确 ...
- Razor button
比起Web Form開發,在後端(.cs)寫法上大同小異,可選擇C#或VB.NET來撰寫:而在前端(.cshtml..vbhtml)則有比較大的差別,自 MVC3版本後,就以Razor為前端檢視引擎, ...
- js右侧悬浮框
示例:屏幕右侧悬浮框 原理:oDiv.style.top = document.documentElement.clientHeight - oDiv.offsetHeight + scrollTop ...