com.netflix.astyanax.connectionpool.impl
Class CountingConnectionPoolMonitor

java.lang.Object
  extended by com.netflix.astyanax.connectionpool.impl.CountingConnectionPoolMonitor
All Implemented Interfaces:
ConnectionPoolMonitor

public class CountingConnectionPoolMonitor
extends Object
implements ConnectionPoolMonitor


Constructor Summary
CountingConnectionPoolMonitor()
           
 
Method Summary
 long getConnectionBorrowedCount()
           
 long getConnectionClosedCount()
           
 long getConnectionCreatedCount()
           
 long getConnectionCreateFailedCount()
           
 long getConnectionReturnedCount()
           
 long getFailoverCount()
           
 long getHostAddedCount()
           
 long getHostDownCount()
           
 long getHostReactivatedCount()
           
 long getHostRemovedCount()
           
 Map<Host,HostStats> getHostStats()
          Return a mapping of all hosts and their statistics
 long getNoHostCount()
           
 long getNoHostsCount()
           
 long getNumBusyConnections()
           
 long getNumOpenConnections()
           
 long getOperationFailureCount()
           
 long getOperationSuccessCount()
           
 long getOperationTimeoutCount()
           
 long getPoolExhaustedTimeoutCount()
           
 void incConnectionBorrowed(Host host, long delay)
          Incremented for each connection borrowed
 void incConnectionClosed(Host host, Exception reason)
          Closed a connection
 void incConnectionCreated(Host host)
          Created a connection successfully
 void incConnectionCreateFailed(Host host, Exception reason)
          Attempt to create a connection failed
 void incConnectionReturned(Host host)
          Incremented for each connection returned.
 void incFailover(Host host, Exception reason)
          An operation failed by the connection pool will attempt to fail over to another host/connection.
 void incNoHosts()
          There were no active hosts in the pool to borrow from.
 void incOperationFailure(Host host, Exception reason)
          Errors trying to execute an operation
 void incOperationSuccess(Host host, long latency)
          Succeeded in executing an operation
 void incOperationTimeout()
          Timeout waiting for a response from the cluster
 void incPoolExhaustedTimeout()
          Timeout trying to get a connection from the pool
 void onHostAdded(Host host, HostConnectionPool<?> pool)
          A host was added and given the associated pool.
 void onHostDown(Host host, Exception reason)
          A host was identified as downed.
 void onHostReactivated(Host host, HostConnectionPool<?> pool)
          A host was reactivated after being marked down
 void onHostRemoved(Host host)
          A host was removed from the pool.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CountingConnectionPoolMonitor

public CountingConnectionPoolMonitor()
Method Detail

incOperationFailure

public void incOperationFailure(Host host,
                                Exception reason)
Description copied from interface: ConnectionPoolMonitor
Errors trying to execute an operation

Specified by:
incOperationFailure in interface ConnectionPoolMonitor

getOperationFailureCount

public long getOperationFailureCount()
Specified by:
getOperationFailureCount in interface ConnectionPoolMonitor

incOperationSuccess

public void incOperationSuccess(Host host,
                                long latency)
Description copied from interface: ConnectionPoolMonitor
Succeeded in executing an operation

Specified by:
incOperationSuccess in interface ConnectionPoolMonitor

getOperationSuccessCount

public long getOperationSuccessCount()
Specified by:
getOperationSuccessCount in interface ConnectionPoolMonitor

incConnectionCreated

public void incConnectionCreated(Host host)
Description copied from interface: ConnectionPoolMonitor
Created a connection successfully

Specified by:
incConnectionCreated in interface ConnectionPoolMonitor

getConnectionCreatedCount

public long getConnectionCreatedCount()
Specified by:
getConnectionCreatedCount in interface ConnectionPoolMonitor

incConnectionClosed

public void incConnectionClosed(Host host,
                                Exception reason)
Description copied from interface: ConnectionPoolMonitor
Closed a connection

Specified by:
incConnectionClosed in interface ConnectionPoolMonitor
reason - TODO: Make the host available to this

getConnectionClosedCount

public long getConnectionClosedCount()
Specified by:
getConnectionClosedCount in interface ConnectionPoolMonitor

incConnectionCreateFailed

public void incConnectionCreateFailed(Host host,
                                      Exception reason)
Description copied from interface: ConnectionPoolMonitor
Attempt to create a connection failed

Specified by:
incConnectionCreateFailed in interface ConnectionPoolMonitor

getConnectionCreateFailedCount

public long getConnectionCreateFailedCount()
Specified by:
getConnectionCreateFailedCount in interface ConnectionPoolMonitor

incConnectionBorrowed

public void incConnectionBorrowed(Host host,
                                  long delay)
Description copied from interface: ConnectionPoolMonitor
Incremented for each connection borrowed

Specified by:
incConnectionBorrowed in interface ConnectionPoolMonitor
Parameters:
host - Host from which the connection was borrowed
delay - Time spent in the connection pool borrowing the connection

getConnectionBorrowedCount

public long getConnectionBorrowedCount()
Specified by:
getConnectionBorrowedCount in interface ConnectionPoolMonitor

incConnectionReturned

public void incConnectionReturned(Host host)
Description copied from interface: ConnectionPoolMonitor
Incremented for each connection returned.

Specified by:
incConnectionReturned in interface ConnectionPoolMonitor
Parameters:
host - Host to which connection is returned

getConnectionReturnedCount

public long getConnectionReturnedCount()
Specified by:
getConnectionReturnedCount in interface ConnectionPoolMonitor

incPoolExhaustedTimeout

public void incPoolExhaustedTimeout()
Description copied from interface: ConnectionPoolMonitor
Timeout trying to get a connection from the pool

Specified by:
incPoolExhaustedTimeout in interface ConnectionPoolMonitor

getPoolExhaustedTimeoutCount

public long getPoolExhaustedTimeoutCount()
Specified by:
getPoolExhaustedTimeoutCount in interface ConnectionPoolMonitor

incOperationTimeout

public void incOperationTimeout()
Description copied from interface: ConnectionPoolMonitor
Timeout waiting for a response from the cluster

Specified by:
incOperationTimeout in interface ConnectionPoolMonitor

getOperationTimeoutCount

public long getOperationTimeoutCount()
Specified by:
getOperationTimeoutCount in interface ConnectionPoolMonitor

incFailover

public void incFailover(Host host,
                        Exception reason)
Description copied from interface: ConnectionPoolMonitor
An operation failed by the connection pool will attempt to fail over to another host/connection.

Specified by:
incFailover in interface ConnectionPoolMonitor

getFailoverCount

public long getFailoverCount()
Specified by:
getFailoverCount in interface ConnectionPoolMonitor

onHostAdded

public void onHostAdded(Host host,
                        HostConnectionPool<?> pool)
Description copied from interface: ConnectionPoolMonitor
A host was added and given the associated pool. The pool is immutable and can be used to get info about the number of open connections

Specified by:
onHostAdded in interface ConnectionPoolMonitor

getHostAddedCount

public long getHostAddedCount()

onHostRemoved

public void onHostRemoved(Host host)
Description copied from interface: ConnectionPoolMonitor
A host was removed from the pool. This is usually called when a downed host is removed from the ring.

Specified by:
onHostRemoved in interface ConnectionPoolMonitor

getHostRemovedCount

public long getHostRemovedCount()

onHostDown

public void onHostDown(Host host,
                       Exception reason)
Description copied from interface: ConnectionPoolMonitor
A host was identified as downed.

Specified by:
onHostDown in interface ConnectionPoolMonitor
reason - Exception that caused the host to be identified as down

getHostDownCount

public long getHostDownCount()

onHostReactivated

public void onHostReactivated(Host host,
                              HostConnectionPool<?> pool)
Description copied from interface: ConnectionPoolMonitor
A host was reactivated after being marked down

Specified by:
onHostReactivated in interface ConnectionPoolMonitor

getHostReactivatedCount

public long getHostReactivatedCount()

incNoHosts

public void incNoHosts()
Description copied from interface: ConnectionPoolMonitor
There were no active hosts in the pool to borrow from.

Specified by:
incNoHosts in interface ConnectionPoolMonitor

getNoHostsCount

public long getNoHostsCount()

getNumBusyConnections

public long getNumBusyConnections()

getNumOpenConnections

public long getNumOpenConnections()

toString

public String toString()
Overrides:
toString in class Object

getHostStats

public Map<Host,HostStats> getHostStats()
Description copied from interface: ConnectionPoolMonitor
Return a mapping of all hosts and their statistics

Specified by:
getHostStats in interface ConnectionPoolMonitor
Returns:

getNoHostCount

public long getNoHostCount()
Specified by:
getNoHostCount in interface ConnectionPoolMonitor


Copyright © 2012. All Rights Reserved.