me.prettyprint.cassandra.service
Class CassandraClientMonitor

java.lang.Object
  extended by me.prettyprint.cassandra.service.CassandraClientMonitor
All Implemented Interfaces:
CassandraClientMonitorMBean

public class CassandraClientMonitor
extends Object
implements CassandraClientMonitorMBean


Nested Class Summary
static class CassandraClientMonitor.Counter
          List of available JMX counts
 
Constructor Summary
CassandraClientMonitor(HConnectionManager connectionManager)
           
 
Method Summary
 boolean addCassandraHost(String hostStr)
          Add a host in the format of "[hostname]:[port]"
 Set<String> getExhaustedPoolNames()
          List of exhausted pools.
 List<String> getKnownHosts()
           
 int getNumActive()
          Total number of active clients in all client pools
 int getNumBlockedThreads()
          Number of threads that are currently blocked, waiting for a free connection.
 long getNumConnectionErrors()
          How many times did initial connection failed.
 int getNumExhaustedPools()
          Number of exhausted connection pools
 int getNumIdleConnections()
          Total number of idle clients in all client pools
 long getNumPoolExhaustedEventCount()
           
 int getNumPools()
          Number of existing connection pools.
 long getReadFail()
           
 long getReadSuccess()
           
 long getRecoverableErrorCount()
          Returns the total number of recoverable errors which is the sum of getRecoverableTimedOutCount, getRecoverableTimedOutCount and getRecoverableTransportExceptionCount
 long getRecoverableLoadBalancedConnectErrors()
           
 long getRecoverableTimedOutCount()
           
 long getRecoverableTransportExceptionCount()
           
 long getRecoverableUnavailableCount()
           
 long getSkipHostSuccess()
           
 List<String> getStatisticsPerPool()
          Retrieves stats per pool.
 Set<String> getSuspendedCassandraHosts()
           
 long getWriteFail()
           
 long getWriteSuccess()
           
 void incCounter(CassandraClientMonitor.Counter counterType)
           
 boolean removeCassandraHost(String hostStr)
          Remove a host in the format of "[hostname]:[port]"
 boolean suspendCassandraHost(String hostStr)
           
 boolean unsuspendCassandraHost(String hostStr)
           
 void updateKnownHosts()
          Tells all pulls to update their list of known hosts.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CassandraClientMonitor

public CassandraClientMonitor(HConnectionManager connectionManager)
Method Detail

incCounter

public void incCounter(CassandraClientMonitor.Counter counterType)

getWriteSuccess

public long getWriteSuccess()

getReadFail

public long getReadFail()
Specified by:
getReadFail in interface CassandraClientMonitorMBean
Returns:
Number of failed (and not recovered) reads.

getReadSuccess

public long getReadSuccess()

getSkipHostSuccess

public long getSkipHostSuccess()
Specified by:
getSkipHostSuccess in interface CassandraClientMonitorMBean
Returns:
Number of times a skip-host was performed. Hosts are skipped when there are errors at the current host.

getRecoverableTimedOutCount

public long getRecoverableTimedOutCount()
Specified by:
getRecoverableTimedOutCount in interface CassandraClientMonitorMBean
Returns:
Number of TimedOutException that the client has been able to recover from by failing over to a different host in the ring.

getRecoverableUnavailableCount

public long getRecoverableUnavailableCount()
Specified by:
getRecoverableUnavailableCount in interface CassandraClientMonitorMBean
Returns:
Number of UnavailableException that the client has been able to recover from by failing over to a different host in the ring.

getWriteFail

public long getWriteFail()
Specified by:
getWriteFail in interface CassandraClientMonitorMBean
Returns:
Number of failed (and not-recovered) writes.

updateKnownHosts

public void updateKnownHosts()
                      throws HectorTransportException
Description copied from interface: CassandraClientMonitorMBean
Tells all pulls to update their list of known hosts. This is useful when an admin adds/removes a host from the ring and wants the application to update asap.

Specified by:
updateKnownHosts in interface CassandraClientMonitorMBean
Throws:
HectorTransportException

getNumPoolExhaustedEventCount

public long getNumPoolExhaustedEventCount()
Specified by:
getNumPoolExhaustedEventCount in interface CassandraClientMonitorMBean
Returns:
Number of times clients were requested when connection pools were exhausted.

getExhaustedPoolNames

public Set<String> getExhaustedPoolNames()
Description copied from interface: CassandraClientMonitorMBean
List of exhausted pools.

Specified by:
getExhaustedPoolNames in interface CassandraClientMonitorMBean
Returns:

getNumActive

public int getNumActive()
Description copied from interface: CassandraClientMonitorMBean
Total number of active clients in all client pools

Specified by:
getNumActive in interface CassandraClientMonitorMBean

getNumBlockedThreads

public int getNumBlockedThreads()
Description copied from interface: CassandraClientMonitorMBean
Number of threads that are currently blocked, waiting for a free connection. This number may be greater than 0 only if the ExhaustedPolicy is ExhaustedPolicy.WHEN_EXHAUSTED_BLOCK

Specified by:
getNumBlockedThreads in interface CassandraClientMonitorMBean

getNumExhaustedPools

public int getNumExhaustedPools()
Description copied from interface: CassandraClientMonitorMBean
Number of exhausted connection pools

Specified by:
getNumExhaustedPools in interface CassandraClientMonitorMBean
Returns:

getNumIdleConnections

public int getNumIdleConnections()
Description copied from interface: CassandraClientMonitorMBean
Total number of idle clients in all client pools

Specified by:
getNumIdleConnections in interface CassandraClientMonitorMBean

getNumPools

public int getNumPools()
Description copied from interface: CassandraClientMonitorMBean
Number of existing connection pools. There may be up to one pool per cassandra host.

Specified by:
getNumPools in interface CassandraClientMonitorMBean

getKnownHosts

public List<String> getKnownHosts()
Specified by:
getKnownHosts in interface CassandraClientMonitorMBean

getStatisticsPerPool

public List<String> getStatisticsPerPool()
Description copied from interface: CassandraClientMonitorMBean
Retrieves stats per pool.

Specified by:
getStatisticsPerPool in interface CassandraClientMonitorMBean

getRecoverableTransportExceptionCount

public long getRecoverableTransportExceptionCount()
Specified by:
getRecoverableTransportExceptionCount in interface CassandraClientMonitorMBean
Returns:
Number of TTransportException that the client has been able to recover from by failing over to a different host in the ring.

getRecoverableErrorCount

public long getRecoverableErrorCount()
Description copied from interface: CassandraClientMonitorMBean
Returns the total number of recoverable errors which is the sum of getRecoverableTimedOutCount, getRecoverableTimedOutCount and getRecoverableTransportExceptionCount

Specified by:
getRecoverableErrorCount in interface CassandraClientMonitorMBean
Returns:
the total number of recoverable errors by failing over the other hosts.

getRecoverableLoadBalancedConnectErrors

public long getRecoverableLoadBalancedConnectErrors()
Specified by:
getRecoverableLoadBalancedConnectErrors in interface CassandraClientMonitorMBean

getNumConnectionErrors

public long getNumConnectionErrors()
Description copied from interface: CassandraClientMonitorMBean
How many times did initial connection failed.

Specified by:
getNumConnectionErrors in interface CassandraClientMonitorMBean
Returns:

addCassandraHost

public boolean addCassandraHost(String hostStr)
Description copied from interface: CassandraClientMonitorMBean
Add a host in the format of "[hostname]:[port]"

Specified by:
addCassandraHost in interface CassandraClientMonitorMBean
Returns:

removeCassandraHost

public boolean removeCassandraHost(String hostStr)
Description copied from interface: CassandraClientMonitorMBean
Remove a host in the format of "[hostname]:[port]"

Specified by:
removeCassandraHost in interface CassandraClientMonitorMBean
Returns:
See Also:
CassandraHost#equals(Object)} for how hosts are compared

getSuspendedCassandraHosts

public Set<String> getSuspendedCassandraHosts()
Specified by:
getSuspendedCassandraHosts in interface CassandraClientMonitorMBean

suspendCassandraHost

public boolean suspendCassandraHost(String hostStr)
Specified by:
suspendCassandraHost in interface CassandraClientMonitorMBean
Returns:
See Also:
#removeCassandraHost(String)} above for semantics of the host string., HConnectionManager#removeCassandraHost(CassandraHost)} for details of this operation.

unsuspendCassandraHost

public boolean unsuspendCassandraHost(String hostStr)
Specified by:
unsuspendCassandraHost in interface CassandraClientMonitorMBean
Returns:
See Also:
#suspendCassandraHost(String)} above. This is the opposite.


Copyright © 2011. All Rights Reserved.