org.jasig.cas.monitor
Class DataSourceMonitor
java.lang.Object
org.jasig.cas.monitor.AbstractNamedMonitor<PoolStatus>
org.jasig.cas.monitor.AbstractPoolMonitor
org.jasig.cas.monitor.DataSourceMonitor
- All Implemented Interfaces:
- Monitor<PoolStatus>
public class DataSourceMonitor
- extends AbstractPoolMonitor
Monitors a data source that describes a single connection or connection pool to a database.
- Since:
- 3.5.1
- Author:
- Marvin S. Addison
|
Method Summary |
protected StatusCode |
checkPool()
Performs a health check on a the pool. |
protected int |
getActiveCount()
Gets the number of pool resources active at present. |
protected int |
getIdleCount()
Gets the number of pool resources idle at present. |
void |
setValidationQuery(String query)
Sets the validation query used to monitor the data source. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DataSourceMonitor
public DataSourceMonitor(DataSource dataSource)
- Creates a new instance that monitors the given data source.
- Parameters:
dataSource - Data source to monitor.
setValidationQuery
public void setValidationQuery(String query)
- Sets the validation query used to monitor the data source. The validation query should return
at least one result; otherwise results are ignored.
- Parameters:
query - Validation query that should be as efficient as possible.
checkPool
protected StatusCode checkPool()
throws Exception
- Description copied from class:
AbstractPoolMonitor
- Performs a health check on a the pool. The recommended implementation is to
obtain a pool resource, validate it, and return it to the pool.
- Specified by:
checkPool in class AbstractPoolMonitor
- Returns:
- Status code describing pool health.
- Throws:
Exception - Thrown to indicate a serious problem with pool validation.
getIdleCount
protected int getIdleCount()
- Description copied from class:
AbstractPoolMonitor
- Gets the number of pool resources idle at present.
- Specified by:
getIdleCount in class AbstractPoolMonitor
- Returns:
- Number of idle pool resources.
getActiveCount
protected int getActiveCount()
- Description copied from class:
AbstractPoolMonitor
- Gets the number of pool resources active at present.
- Specified by:
getActiveCount in class AbstractPoolMonitor
- Returns:
- Number of active pool resources.
Copyright © 2004-2013 Jasig. All Rights Reserved.