The connection object contains logic to find the master, locate regions out on the cluster, keeps a cache of locations and then knows how to re-calibrate after they move. The individual connections to servers, meta cache, zookeeper connection, etc are all shared by the {@link Table} and {@link Admin} instances obtained from this connection.
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 notthread-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.
This class replaces {@link HConnection}, which is now deprecated. @see ConnectionFactory
|
|