Reputation: 6342
I am using HBase 1.2, and I am reading/write HBase in a web application.
Following is the javadoc for the HBase Connection 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.
From the doc, The Connection
object is thread safe, so that I could create a singleton connection among the application.
My question is:
If I haven't used this Connection
object to read/write HBase for a long time, will this Connection object be a dead object, that is , I have to ping HBase using this Connection periodically?
This is how long a connection can be idle issue.
Upvotes: 1
Views: 279
Reputation: 5541
This is all managed from within the Connection
itself - if it's been inactive for a while it will automatically "wake up" the next time you call it.
Upvotes: 1