HBase 连接应该保持活动状态吗?

Should HBase Connection be kept alive?

我正在使用 HBase 1.2,我是 reading/write Web 应用程序中的 HBase。

以下是 HBase 连接的 javadoc class

 * <p> Connection creation is a heavy-weight operation. Connection implementations are thread-safe,
 * so that the client can create a connection once, and share it with different threads.
 * {@link Table} and {@link Admin} instances, on the other hand, are light-weight and are not
 * thread-safe.  Typically, a single connection per client application is instantiated and every
 * thread will obtain its own Table instance. Caching or pooling of {@link Table} and {@link Admin}
 * is not recommended.

根据文档,Connection 对象是线程安全的,因此我可以在应用程序之间创建单例连接。

我的问题是:

如果我很久没有使用这个Connection对象到read/writeHBase,这个Connection对象会不会是一个死对象,也就是说,我必须使用这个Connection来ping HBase定期?

这是一个连接可以空闲多长时间的问题。

这一切都是在 Connection 内部管理的 - 如果它有一段时间不活动,它会在您下次调用它时自动 "wake up"。