me.prettyprint.cassandra.connection
Class ConcurrentHClientPool

java.lang.Object
  extended by me.prettyprint.cassandra.connection.ConcurrentHClientPool
All Implemented Interfaces:
HClientPool, PoolMetric
Direct Known Subclasses:
LatencyAwareHClientPool

public class ConcurrentHClientPool
extends Object
implements HClientPool


Constructor Summary
ConcurrentHClientPool(CassandraHost host)
           
 
Method Summary
 HThriftClient borrowClient()
           
 CassandraHost getCassandraHost()
           
 boolean getIsActive()
           
 int getMaxActive()
           
 String getName()
           
 int getNumActive()
           
 int getNumBeforeExhausted()
           
 int getNumBlockedThreads()
           
 int getNumIdle()
           
 String getStatusAsString()
           
 boolean isExhausted()
           
 void releaseClient(HThriftClient client)
           
 void shutdown()
          Controlled shutdown of pool.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConcurrentHClientPool

public ConcurrentHClientPool(CassandraHost host)
Method Detail

borrowClient

public HThriftClient borrowClient()
                           throws HectorException
Specified by:
borrowClient in interface HClientPool
Throws:
HectorException

shutdown

public void shutdown()
Controlled shutdown of pool. Go through the list of available clients in the queue and call HThriftClient.close() on each. Toggles a flag to indicate we are going into shutdown mode. Any subsequent calls will throw an IllegalArgumentException.

Specified by:
shutdown in interface HClientPool

getCassandraHost

public CassandraHost getCassandraHost()
Specified by:
getCassandraHost in interface HClientPool

getName

public String getName()
Specified by:
getName in interface PoolMetric

getNumActive

public int getNumActive()
Specified by:
getNumActive in interface PoolMetric

getNumBeforeExhausted

public int getNumBeforeExhausted()
Specified by:
getNumBeforeExhausted in interface HClientPool

getNumBlockedThreads

public int getNumBlockedThreads()
Specified by:
getNumBlockedThreads in interface PoolMetric

getNumIdle

public int getNumIdle()
Specified by:
getNumIdle in interface PoolMetric

isExhausted

public boolean isExhausted()
Specified by:
isExhausted in interface HClientPool

getMaxActive

public int getMaxActive()
Specified by:
getMaxActive in interface HClientPool

getIsActive

public boolean getIsActive()
Specified by:
getIsActive in interface PoolMetric

getStatusAsString

public String getStatusAsString()
Specified by:
getStatusAsString in interface HClientPool

releaseClient

public void releaseClient(HThriftClient client)
                   throws HectorException
Specified by:
releaseClient in interface HClientPool
Throws:
HectorException


Copyright © 2011. All Rights Reserved.