public class PooledConnectionFactory extends org.apache.commons.pool2.BasePooledObjectFactory<Connection>
The new HBase Client API changes removed the existing connection pool implementation and placed the responsibility of managing the lifecycle of connections on the caller. A pool is necessary as creating connections to the cluster via. zookeeper is fairly expensive.
| Constructor and Description |
|---|
PooledConnectionFactory(org.apache.hadoop.conf.Configuration config) |
| Modifier and Type | Method and Description |
|---|---|
void |
activateObject(org.apache.commons.pool2.PooledObject<Connection> p) |
Connection |
create() |
void |
destroyObject(org.apache.commons.pool2.PooledObject<Connection> p) |
void |
passivateObject(org.apache.commons.pool2.PooledObject<Connection> p) |
void |
setPool(org.apache.commons.pool2.ObjectPool<Connection> pool) |
boolean |
validateObject(org.apache.commons.pool2.PooledObject<Connection> p) |
org.apache.commons.pool2.PooledObject<Connection> |
wrap(Connection con) |
public PooledConnectionFactory(org.apache.hadoop.conf.Configuration config)
public void setPool(org.apache.commons.pool2.ObjectPool<Connection> pool)
public Connection create() throws Exception
create in class org.apache.commons.pool2.BasePooledObjectFactory<Connection>Exceptionpublic org.apache.commons.pool2.PooledObject<Connection> wrap(Connection con)
wrap in class org.apache.commons.pool2.BasePooledObjectFactory<Connection>public void destroyObject(org.apache.commons.pool2.PooledObject<Connection> p) throws Exception
destroyObject in interface org.apache.commons.pool2.PooledObjectFactory<Connection>destroyObject in class org.apache.commons.pool2.BasePooledObjectFactory<Connection>Exceptionpublic boolean validateObject(org.apache.commons.pool2.PooledObject<Connection> p)
validateObject in interface org.apache.commons.pool2.PooledObjectFactory<Connection>validateObject in class org.apache.commons.pool2.BasePooledObjectFactory<Connection>public void activateObject(org.apache.commons.pool2.PooledObject<Connection> p) throws Exception
activateObject in interface org.apache.commons.pool2.PooledObjectFactory<Connection>activateObject in class org.apache.commons.pool2.BasePooledObjectFactory<Connection>Exceptionpublic void passivateObject(org.apache.commons.pool2.PooledObject<Connection> p) throws Exception
passivateObject in interface org.apache.commons.pool2.PooledObjectFactory<Connection>passivateObject in class org.apache.commons.pool2.BasePooledObjectFactory<Connection>ExceptionCopyright © 2021. All Rights Reserved.