【甘道夫】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,通过 ...
随机推荐
- HDOJ 5276 YJC tricks time multimap
multimap的使用 YJC tricks time Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 524288/262144 K ...
- ibatis dynamic的用法
<select id="idididid" resultClass="java.uitl.HashMap" parameterClass="ja ...
- CentOS 网络设置修改
环境: 系统硬件:vmware vsphere (CPU:2*4核,内存2G) 系统版本:Centos-6.5-x86_64 路由器网关:192.168.1.1 步骤: 1.查看网络MAC地址 [ro ...
- windows phone (17) ManipulationDelta事件
原文:windows phone (17) ManipulationDelta事件 ManipulationDelta事件会是在触摸位置发生变化是引发,比如可以根据用户在触摸屏中移动的位置,图片发生相 ...
- poj 3250 Bad Hair Day (单调栈)
Bad Hair Day Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 14883 Accepted: 4940 Des ...
- linux sed命令详解(转)
简介 sed 是一种在线编辑器,它一次处理一行内容.处理时,把当前处理的行存储在临时缓冲区中,称为“模式空间”(pattern space),接着用sed命令处理缓冲区中的内容,处理完成后,把缓冲区的 ...
- hibernate 批量处理数据
批量处理数据是指处理大量数据的一个单独的事务. 在应用层批处理操作, 主要有以下方式: 通过 Session 通过 HQL 通过 StatelessSession 通过 JDBC API(仅仅要会用这 ...
- ACdream 之ACfun 题解
A - ACfun Time Limit: 2000/1000MS (Java/Others) Memory Limit: 128000/64000KB (Java/Others) SubmitSta ...
- ACE 主动对象模式的按部就班的实现方法
ACE的主动对象模式的实现 对分布式系统设计来说,ACE提供的主动对象模式是让我们在系统框架构建的时候,回归到传统的单线程编程思维.你可能要问,既然有主动对象,那必然有被动对象,没有错,确实有被动对象 ...
- Hbase0.96源码之HMaster(二)Hmaster主要循环becomeActiveMaster
1,Hmaster主循环主要这里主要有: 1,1 becomeActiveMaster(startupStatus); 1.2 finishInitialization 1.3 loop() beco ...