throw new KunderaException("All hosts are down. please check servers manully.");
}
IPooledConnection getConnection(IThriftPool pool)
{
IThriftPool iThriftPool = pool;
boolean success = false;
while (!success)
{
success = true;
if (iThriftPool != null)
{
Node[] nodes = ((CommonsBackedPool) iThriftPool).getCluster().getNodes();
String host = nodes[0].getAddress();
int thriftPort = ((CommonsBackedPool) iThriftPool).getCluster().getConnectionConfig().getThriftPort();
CassandraHost cassandraHost = ((CassandraHostConfiguration) configuration).getCassandraHost(
nodes[0].getAddress(), ((CommonsBackedPool) pool).getCluster().getConnectionConfig()
.getThriftPort());
if (cassandraHost.isTestOnBorrow())
{
if (cassandraHost.isTestOnBorrow() && CassandraUtilities.verifyConnection(host, thriftPort))
{
// logger.info("Returning connection of {} :{} .",
// nodes[0].getAddress(), thriftPort);
return iThriftPool.getConnection();
}
removePool(iThriftPool);
}
else
{
// logger.info("Returning connection of {} :{} .",
// nodes[0].getAddress(), thriftPort);
return iThriftPool.getConnection();
}
removePool(iThriftPool);
}
success = false;
iThriftPool = getPoolUsingPolicy();