HBase连接是否应保持活动状态?
我正在使用HBase 1.2,我正在web应用程序中读/写HBase 下面是HBase连接类的javadocHBase连接是否应保持活动状态?,hbase,Hbase,我正在使用HBase 1.2,我正在web应用程序中读/写HBase 下面是HBase连接类的javadoc * <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.
* <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.
*连接创建是一项繁重的操作。连接实现是线程安全的,
*这样客户端就可以创建一次连接,并与不同的线程共享。
*另一方面,{@link Table}和{@link Admin}实例是轻量级的,不是
*线程安全。通常,每个客户端应用程序都会实例化一个连接,并且每个
*线程将获得自己的表实例。{@link Table}和{@link Admin}的缓存或池
*不建议使用。
从doc来看,Connection
对象是线程安全的,因此我可以在应用程序之间创建单例连接
我的问题是:
如果我很长一段时间没有使用此连接对象来读/写HBase,此连接对象是否会是一个死对象,也就是说,我必须定期使用此连接ping HBase
这是连接可以空闲多长时间的问题。这都是从连接本身内部管理的-如果它已停用一段时间,它将在下次调用它时自动“唤醒”