- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
一种方法是直接调用 HTable 构造函数,另一种方法是从 HConnection 调用 getTable 方法。第二个选项要求 HConnection 为“非托管”,这对我来说不是很好,因为我的进程将有许多线程访问 HBase。我不想自己重新发明轮子来管理 HConnection。
谢谢你的帮助。
[更新]:
我们坚持使用 0.98.6,因此 ConnectionFactory 不可用。
我发现波纹管 jira 建议创建一个“非托管”连接并使用单个 ExecuteService 来创建 HTable。为什么不能简单的使用非托管连接的getTable方法来获取HTable呢?那是因为HTable不是线程安全的吗?
https://issues.apache.org/jira/browse/HBASE-7463
最佳答案
我坚持使用旧版本(<0.94.11),您仍然可以使用 HTablePool
但由于它已被 HBASE-6580 弃用我认为现在通过提供 ExecutorService
自动汇集从 HTables 到 RS 的请求。 :
ExecutorService executor = Executors.newFixedThreadPool(10);
Connection connection = ConnectionFactory.createConnection(conf, executor);
Table table = connection.getTable(TableName.valueOf("mytable"));
try {
table.get(...);
...
} finally {
table.close();
connection.close();
}
I've been unable to find any good examples/docs about it, so please notice this is untested code which may not work as expected.
HConnection connection = HConnectionManager.createConnection(config); // You can also provide an ExecutorService if you want to override the default one. HConnection is thread safe.
HTableInterface table = connection.getTable("table1");
try {
// Use the table as needed, for a single operation and a single thread
} finally {
table.close();
connection.close();
}
HTableInterface table = connection.getTable("table1")
获得一个新实例(这是一个轻量级进程)。然后用
table.close()
关闭它.
关于apache - 获得 HBase 的 HTable 句柄的最佳方法是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29482803/
我设置了 Helm 柄和 Helm 柄。我有tiller-deploy。昨天,我可以定期运行了。但今天我收到此错误消息 Error: could not find a ready tiller pod
我以前已将分er安装到特定的 namespace 中。 我设置了一个环境变量来设置'tiller'命名空间-但我不记得该环境变量的名称-而且似乎无法通过网络搜索找到它。 这是什么 key ? 最佳答案
当我在 View 模型中使用如下界面时 class MainViewModel @ViewModelInject constructor( private val trafficImagesR
我正在尝试找到如何在某个 fragment 相关场景中定义 Hilt 的解决方案。我有以下设置: Activity 父 fragment 1 子 fragment 1 子 fragment 2 ...
Hilt 指出如果没有@Provides 注解就不能提供这个接口(interface): interface PlannedListRepository { fun getAllLists()
我的问题非常简单明了:两个注释/示例之间有什么区别: 例子一 @Singleton class MySingletonClass() {} @Module @InstallIn(FragmentCom
我是一名优秀的程序员,十分优秀!