me.prettyprint.cassandra.connection
Class HConnectionManager

java.lang.Object
  extended by me.prettyprint.cassandra.connection.HConnectionManager

public class HConnectionManager
extends Object


Constructor Summary
HConnectionManager(String clusterName, CassandraHostConfigurator cassandraHostConfigurator)
           
 
Method Summary
 boolean addCassandraHost(CassandraHost cassandraHost)
          Returns true if the host was successfully added.
 long createClock()
           
 Collection<HClientPool> getActivePools()
           
 String getClusterName()
           
 Set<CassandraHost> getDownedHosts()
           
 Set<CassandraHost> getHosts()
           
 List<String> getStatusPerPool()
           
 Set<CassandraHost> getSuspendedCassandraHosts()
          Returns a Set of CassandraHost which are in the suspended status
 HOpTimer getTimer()
           
 void operateWithFailover(Operation<?> op)
           
 boolean removeCassandraHost(CassandraHost cassandraHost)
          Remove the CassandraHost from the pool, bypassing retry service.
 void setTimer(HOpTimer timer)
           
 void shutdown()
           
 boolean suspendCassandraHost(CassandraHost cassandraHost)
          Remove the HClientPool referenced by the CassandraHost from the active host pools.
 boolean unsuspendCassandraHost(CassandraHost cassandraHost)
          The opposite of suspendCassandraHost, places the pool back into selection
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HConnectionManager

public HConnectionManager(String clusterName,
                          CassandraHostConfigurator cassandraHostConfigurator)
Method Detail

addCassandraHost

public boolean addCassandraHost(CassandraHost cassandraHost)
Returns true if the host was successfully added. In any sort of failure exceptions are caught and logged, returning false.

Parameters:
cassandraHost -
Returns:

removeCassandraHost

public boolean removeCassandraHost(CassandraHost cassandraHost)
Remove the CassandraHost from the pool, bypassing retry service. This would be called on a host that is known to be going away. Gracefully shuts down the underlying connections via HClientPool.shutdown(). This method will also:

Parameters:
cassandraHost -

suspendCassandraHost

public boolean suspendCassandraHost(CassandraHost cassandraHost)
Remove the HClientPool referenced by the CassandraHost from the active host pools. This does not shut down the pool, only removes it as a candidate from future operations.

Parameters:
cassandraHost -
Returns:
true if the operation was successful.

unsuspendCassandraHost

public boolean unsuspendCassandraHost(CassandraHost cassandraHost)
The opposite of suspendCassandraHost, places the pool back into selection

Parameters:
cassandraHost -
Returns:
true if this operation was successful. A no-op returning false if there was no such host in the underlying suspendedHostPool map.

getSuspendedCassandraHosts

public Set<CassandraHost> getSuspendedCassandraHosts()
Returns a Set of CassandraHost which are in the suspended status

Returns:

getHosts

public Set<CassandraHost> getHosts()

getStatusPerPool

public List<String> getStatusPerPool()

operateWithFailover

public void operateWithFailover(Operation<?> op)
                         throws HectorException
Throws:
HectorException

getTimer

public HOpTimer getTimer()

setTimer

public void setTimer(HOpTimer timer)

getDownedHosts

public Set<CassandraHost> getDownedHosts()

getActivePools

public Collection<HClientPool> getActivePools()

createClock

public long createClock()

getClusterName

public String getClusterName()

shutdown

public void shutdown()


Copyright © 2011. All Rights Reserved.